Shape class

Inheritance
Implementers

Properties

hashCode int
The hash code for this object.
no setteroverride
isExist bool
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cacheRect() Rect
Update, cache and return the bounding box of a shape based on the body it's attached to.
collide({required Shape a, required Shape b}) ContactPointSet
Return contact information about two shapes.
destroy() → void
Destroy a shape.
getArea() double
Get the calculated area of this shape.
getBody() Body
The cpBody this shape is connected to.
getCenterOfGravity() → Vector2
Get the centroid of this shape.
getCollisionType() int
Set the collision type of this shape.
getData<T>() → T?
Get the user data pointer associated with this pair of colliding objects.
getDensity() double
Get the density of the shape if you are having Chipmunk calculate mass properties for you.
getElasticity() double
Get the elasticity of this shape.
getFilter() ShapeFilter
Get the collision filtering parameters of this shape.
getFriction() double
Get the friction of this shape.
getMass() double
Get the mass of the shape if you are having Chipmunk calculate mass properties for you.
getMoment() double
Get the calculated moment of inertia for this shape.
getRect() Rect
Get the bounding box that contains the shape given it's current position and angle.
getSensor() bool
Get if the shape is set to be a sensor or not.
getSpace() Space
The cpSpace this body is added to.
getSurfaceVelocity() → Vector2
Get the surface velocity of this shape.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pointQuery({required Vector2 point}) → (double, PointQueryInfo)
Perform a nearest point query. It finds the closest point on the surface of shape to a specific point. The value returned is the distance between the points. A negative distance means the point is inside the shape.
removeData() → void
If you need to perform any cleanup for this data, you must do it yourself, in the separate callback for instance.
segmentQuery({required Vector2 a, required Vector2 b, required double radius}) → (bool, SegmentQueryInfo)
Perform a segment query against a shape. @c info must be a pointer to a valid cpSegmentQueryInfo structure.
setBody(Body body) → void
Set the cpBody this shape is connected to. Can only be used if the shape is not currently added to a space.
setCollisionType(int collisionType) → void
Set the collision type of this shape.
setData<T>(T data) → void
Set a user data point associated with this pair of colliding objects.
setDensity(double density) → void
Set the density of this shape to have Chipmunk calculate mass properties for you.
setElasticity(double elasticity) → void
Set the elasticity of this shape.
setFilter(ShapeFilter filter) → void
Set the collision filtering parameters of this shape.
setFriction(double friction) → void
Set the friction of this shape.
setMass(double mass) → void
Set the mass of this shape to have Chipmunk calculate mass properties for you.
setSensor(bool sensor) → void
Set if the shape is a sensor or not.
setSurfaceVelocity(Vector2 surfaceVelocity) → void
Set the surface velocity of this shape.
toString() String
A string representation of this object.
inherited
update(Matrix4 transform) Rect
Update, cache and return the bounding box of a shape with an explicit transformation.

Operators

operator ==(Object other) bool
The equality operator.
override