CP::Shape
Inherits Reference / Object
Defines the shape of a rigid body.
Instance methods
Get the bounding box that contains the shape given its current position and angle.
Only guaranteed to be valid after cache_bb or Space#step is called.
Moving a body that a shape is connected to does not update its bounding box.
For shapes used for queries that aren't attached to bodies, you can also use update.
Set the Body this shape is added to.
Can only be used if the shape is not currently added to a space.
Update, cache and return the bounding box of a shape based on the body it's attached to.
User defined collision type for the shape.
See Space#add_collision_handler for more information.
Get the density of the shape if you are having Chipmunk calculate mass properties for you.
Set the density of this shape to have Chipmunk calculate mass properties for you.
The elasticity of this shape.
A value of 0.0 gives no bounce, while a value of 1.0 will give a 'perfect' bounce. However due to inaccuracies in the simulation using 1.0 or greater is not recommended.
The friction of this shape.
Chipmunk uses the Coulomb friction model, a value of 0.0 is frictionless. A value over 1.0 is also perfectly fine.
Set the mass of this shape to have Chipmunk calculate mass properties for you.
Perform a nearest point query. It finds the closest point on the surface of shape to a specific point.
Perform a segment query against a shape: check if the line segment from start to end intersects the shape.
Is the shape set to be a sensor or not?
Sensors only call collision callbacks, and never generate real collisions.
The surface velocity of this shape.
Useful for creating conveyor belts or players that move around. This value is only used when calculating friction, not resolving the collision.
Update, cache and return the bounding box of a shape with an explicit transformation.
Useful if you have a shape without a body and want to use it for querying.