Chipmunk2D Pro API Reference  6.2.1
 All Classes Functions Variables Typedefs Properties Groups Pages
Classes | Typedefs | Functions
cpBody

Chipmunk's rigid body type. More...

Classes

struct  cpBody
 Chipmunk's rigid body struct. More...
 

Typedefs

typedef void(* cpBodyVelocityFunc )(cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt)
 Rigid body velocity update function type.
 
typedef void(* cpBodyPositionFunc )(cpBody *body, cpFloat dt)
 Rigid body position update function type.
 
typedef struct cpComponentNode cpComponentNode
 Used internally to track information on the collision graph.
 
typedef void(* cpBodyShapeIteratorFunc )(cpBody *body, cpShape *shape, void *data)
 Body/shape iterator callback function type.
 
typedef void(* cpBodyConstraintIteratorFunc )(cpBody *body, cpConstraint *constraint, void *data)
 Body/constraint iterator callback function type.
 
typedef void(* cpBodyArbiterIteratorFunc )(cpBody *body, cpArbiter *arbiter, void *data)
 Body/arbiter iterator callback function type.
 

Functions

cpBodycpBodyAlloc (void)
 Allocate a cpBody.
 
cpBodycpBodyInit (cpBody *body, cpFloat m, cpFloat i)
 Initialize a cpBody.
 
cpBodycpBodyNew (cpFloat m, cpFloat i)
 Allocate and initialize a cpBody.
 
cpBodycpBodyInitStatic (cpBody *body)
 Initialize a static cpBody.
 
cpBodycpBodyNewStatic (void)
 Allocate and initialize a static cpBody.
 
void cpBodyDestroy (cpBody *body)
 Destroy a cpBody.
 
void cpBodyFree (cpBody *body)
 Destroy and free a cpBody.
 
void cpBodySanityCheck (cpBody *body)
 Check that the properties of a body is sane. (Only in debug mode)
 
void cpBodyActivate (cpBody *body)
 Wake up a sleeping or idle body.
 
void cpBodyActivateStatic (cpBody *body, cpShape *filter)
 Wake up any sleeping or idle bodies touching a static body.
 
void cpBodySleep (cpBody *body)
 Force a body to fall asleep immediately.
 
void cpBodySleepWithGroup (cpBody *body, cpBody *group)
 Force a body to fall asleep immediately along with other bodies in a group.
 
static cpBool cpBodyIsSleeping (const cpBody *body)
 Returns true if the body is sleeping.
 
static cpBool cpBodyIsStatic (const cpBody *body)
 Returns true if the body is static.
 
static cpBool cpBodyIsRogue (const cpBody *body)
 Returns true if the body has not been added to a space. More...
 
void cpBodySetMass (cpBody *body, cpFloat m)
 Set the mass of a body.
 
void cpBodySetMoment (cpBody *body, cpFloat i)
 Set the moment of a body.
 
void cpBodySetPos (cpBody *body, cpVect pos)
 Set the position of a body.
 
void cpBodySetAngle (cpBody *body, cpFloat a)
 Set the angle of a body.
 
void cpBodyUpdateVelocity (cpBody *body, cpVect gravity, cpFloat damping, cpFloat dt)
 Default Integration functions.
 
static cpVect cpBodyLocal2World (const cpBody *body, const cpVect v)
 Convert body relative/local coordinates to absolute/world coordinates.
 
static cpVect cpBodyWorld2Local (const cpBody *body, const cpVect v)
 Convert body absolute/world coordinates to relative/local coordinates.
 
void cpBodyResetForces (cpBody *body)
 Set the forces and torque or a body to zero.
 
void cpBodyApplyForce (cpBody *body, const cpVect f, const cpVect r)
 Apply an force (in world coordinates) to the body at a point relative to the center of gravity (also in world coordinates).
 
void cpBodyApplyImpulse (cpBody *body, const cpVect j, const cpVect r)
 Apply an impulse (in world coordinates) to the body at a point relative to the center of gravity (also in world coordinates).
 
cpVect cpBodyGetVelAtWorldPoint (cpBody *body, cpVect point)
 Get the velocity on a body (in world units) at a point on the body in world coordinates.
 
cpVect cpBodyGetVelAtLocalPoint (cpBody *body, cpVect point)
 Get the velocity on a body (in world units) at a point on the body in local coordinates.
 
static cpFloat cpBodyKineticEnergy (const cpBody *body)
 Get the kinetic energy of a body.
 
void cpBodyEachShape (cpBody *body, cpBodyShapeIteratorFunc func, void *data)
 Call func once for each shape attached to body and added to the space.
 
void cpBodyEachConstraint (cpBody *body, cpBodyConstraintIteratorFunc func, void *data)
 Call func once for each constraint attached to body and added to the space.
 
void cpBodyEachArbiter (cpBody *body, cpBodyArbiterIteratorFunc func, void *data)
 Call func once for each arbiter that is currently active on the body.
 

Detailed Description

Chipmunk's rigid body type.

Rigid bodies hold the physical properties of an object like it's mass, and position and velocity of it's center of gravity. They don't have an shape on their own. They are given a shape by creating collision shapes (cpShape) that point to the body.

Function Documentation

static cpBool cpBodyIsRogue ( const cpBody body)
inlinestatic

Returns true if the body has not been added to a space.

Note: Static bodies are a subtype of rogue bodies.