abstract class CP::Shape
- CP::Shape
- Reference
- Object
Overview
Defines the shape of a rigid body.
Direct Known Subclasses
Defined in:
chipmunk/shape.crInstance Method Summary
-
#area : Float64
Get the calculated area of this shape.
-
#bb : BB
Get the bounding box that contains the shape given its current position and angle.
-
#body : Body | Nil
The
Body
this shape is added to. -
#body=(body : Body | Nil)
Set the
Body
this shape is added to. -
#cache_bb : BB
Update, cache and return the bounding box of a shape based on the body it's attached to.
-
#center_of_gravity : Vect
Get the centroid of this shape.
-
#collide(b : Shape) : ContactPointSet
Return contact information about two shapes.
-
#collision_type : CollisionType
User defined collision type for the shape.
- #collision_type=(collision_type : Int)
-
#density : Float64
Get the density of the shape if you are having Chipmunk calculate mass properties for you.
-
#density=(density : Number)
Set the density of this shape to have Chipmunk calculate mass properties for you.
-
#elasticity : Float64
The elasticity of this shape.
- #elasticity=(elasticity : Number)
-
#filter : ShapeFilter
The collision filtering parameters of this shape.
- #filter=(filter : ShapeFilter)
-
#friction : Float64
The friction of this shape.
- #friction=(friction : Number)
-
#mass : Float64
Get the mass of the shape if you are having Chipmunk calculate mass properties for you.
-
#mass=(mass : Number)
Set the mass of this shape to have Chipmunk calculate mass properties for you.
-
#moment : Float64
Get the calculated moment of inertia for this shape.
-
#point_query(p : Vect) : PointQueryInfo
Perform a nearest point query.
-
#segment_query(a : Vect, b : Vect, radius : Number = 0) : SegmentQueryInfo | Nil
Perform a segment query against a shape: check if the line segment from start to end intersects the shape.
- #sensor=(sensor : Bool)
-
#sensor? : Bool
Is the shape set to be a sensor or not?
-
#space : Space | Nil
The
Space
this shape is added to. -
#surface_velocity : Vect
The surface velocity of this shape.
- #surface_velocity=(surface_velocity : Vect)
-
#update(transform : Transform) : BB
Update, cache and return the bounding box of a shape with an explicit transformation.
Instance Method Detail
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.
Return contact information about two shapes.
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.
Get the mass of the shape if you are having Chipmunk calculate mass properties for you.
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.