|
Chipmunk
6.0.3
Chipmunk API Reference for Kobold2D developers
|
Data Structures | |
| struct | cpCollisionHandler |
| struct | cpArbiterThread |
| struct | cpArbiter |
| A colliding pair of shapes. More... | |
| struct | cpContactPointSet |
| A struct that wraps up the important collision data for an arbiter. More... | |
Defines | |
| #define | CP_MAX_CONTACTS_PER_ARBITER 4 |
| #define | CP_DefineArbiterStructGetter(type, member, name) static inline type cpArbiterGet##name(const cpArbiter *arb){return arb->member;} |
| #define | CP_DefineArbiterStructSetter(type, member, name) static inline void cpArbiterSet##name(cpArbiter *arb, type value){arb->member = value;} |
| #define | CP_DefineArbiterStructProperty(type, member, name) |
| #define | CP_ARBITER_GET_SHAPES(arb, a, b) cpShape *a, *b; cpArbiterGetShapes(arb, &a, &b); |
| A macro shortcut for defining and retrieving the shapes from an arbiter. | |
| #define | CP_ARBITER_GET_BODIES(arb, a, b) cpBody *a, *b; cpArbiterGetBodies(arb, &a, &b); |
| A macro shortcut for defining and retrieving the bodies from an arbiter. | |
Typedefs | |
| typedef cpBool(* | cpCollisionBeginFunc )(cpArbiter *arb, cpSpace *space, void *data) |
| typedef cpBool(* | cpCollisionPreSolveFunc )(cpArbiter *arb, cpSpace *space, void *data) |
| typedef void(* | cpCollisionPostSolveFunc )(cpArbiter *arb, cpSpace *space, void *data) |
| Collision post-solve event function callback type. | |
| typedef void(* | cpCollisionSeparateFunc )(cpArbiter *arb, cpSpace *space, void *data) |
| Collision separate event function callback type. | |
Functions | |
| CP_DefineArbiterStructProperty (cpFloat, e, Elasticity) | |
| CP_DefineArbiterStructProperty (cpFloat, u, Friction) | |
| CP_DefineArbiterStructProperty (cpVect, surface_vr, SurfaceVelocity) | |
| cpVect | cpArbiterTotalImpulse (const cpArbiter *arb) |
| cpVect | cpArbiterTotalImpulseWithFriction (const cpArbiter *arb) |
| cpFloat | cpArbiterTotalKE (const cpArbiter *arb) |
| void | cpArbiterIgnore (cpArbiter *arb) |
| static void | cpArbiterGetShapes (const cpArbiter *arb, cpShape **a, cpShape **b) |
| static void | cpArbiterGetBodies (const cpArbiter *arb, cpBody **a, cpBody **b) |
| static cpBool | cpArbiterIsFirstContact (const cpArbiter *arb) |
| Returns true if this is the first step a pair of objects started colliding. | |
| static int | cpArbiterGetCount (const cpArbiter *arb) |
| Get the number of contact points for this arbiter. | |
| cpContactPointSet | cpArbiterGetContactPointSet (const cpArbiter *arb) |
| Return a contact set from an arbiter. | |
| cpVect | cpArbiterGetNormal (const cpArbiter *arb, int i) |
Get the normal of the ith contact point. | |
| cpVect | cpArbiterGetPoint (const cpArbiter *arb, int i) |
Get the position of the ith contact point. | |
| cpFloat | cpArbiterGetDepth (const cpArbiter *arb, int i) |
Get the depth of the ith contact point. | |
The cpArbiter struct controls pairs of colliding shapes. They are also used in conjuction with collision handler callbacks allowing you to retrieve information on the collision and control it.
| #define CP_ARBITER_GET_BODIES | ( | arb, | |
| a, | |||
| b | |||
| ) | cpBody *a, *b; cpArbiterGetBodies(arb, &a, &b); |
A macro shortcut for defining and retrieving the bodies from an arbiter.
| #define CP_ARBITER_GET_SHAPES | ( | arb, | |
| a, | |||
| b | |||
| ) | cpShape *a, *b; cpArbiterGetShapes(arb, &a, &b); |
A macro shortcut for defining and retrieving the shapes from an arbiter.
| #define CP_DefineArbiterStructGetter | ( | type, | |
| member, | |||
| name | |||
| ) | static inline type cpArbiterGet##name(const cpArbiter *arb){return arb->member;} |
| #define CP_DefineArbiterStructProperty | ( | type, | |
| member, | |||
| name | |||
| ) |
CP_DefineArbiterStructGetter(type, member, name) \ CP_DefineArbiterStructSetter(type, member, name)
| #define CP_DefineArbiterStructSetter | ( | type, | |
| member, | |||
| name | |||
| ) | static inline void cpArbiterSet##name(cpArbiter *arb, type value){arb->member = value;} |
| #define CP_MAX_CONTACTS_PER_ARBITER 4 |
| typedef cpBool(* cpCollisionBeginFunc)(cpArbiter *arb, cpSpace *space, void *data) |
Collision begin event function callback type. Returning false from a begin callback causes the collision to be ignored until the the separate callback is called when the objects stop colliding.
| typedef void(* cpCollisionPostSolveFunc)(cpArbiter *arb, cpSpace *space, void *data) |
Collision post-solve event function callback type.
| typedef cpBool(* cpCollisionPreSolveFunc)(cpArbiter *arb, cpSpace *space, void *data) |
Collision pre-solve event function callback type. Returning false from a pre-step callback causes the collision to be ignored until the next step.
| typedef void(* cpCollisionSeparateFunc)(cpArbiter *arb, cpSpace *space, void *data) |
Collision separate event function callback type.
| CP_DefineArbiterStructProperty | ( | cpFloat | , |
| e | , | ||
| Elasticity | |||
| ) |
| CP_DefineArbiterStructProperty | ( | cpFloat | , |
| u | , | ||
| Friction | |||
| ) |
| CP_DefineArbiterStructProperty | ( | cpVect | , |
| surface_vr | , | ||
| SurfaceVelocity | |||
| ) |
Return the colliding bodies involved for this arbiter. The order of the cpSpace.collision_type the bodies are associated with values will match the order set when the collision handler was registered.
| cpContactPointSet cpArbiterGetContactPointSet | ( | const cpArbiter * | arb | ) |
Return a contact set from an arbiter.
| static int cpArbiterGetCount | ( | const cpArbiter * | arb | ) | [inline, static] |
Get the number of contact points for this arbiter.
Get the position of the ith contact point.
| static void cpArbiterGetShapes | ( | const cpArbiter * | arb, |
| cpShape ** | a, | ||
| cpShape ** | b | ||
| ) | [inline, static] |
Return the colliding shapes involved for this arbiter. The order of their cpSpace.collision_type values will match the order set when the collision handler was registered.
| void cpArbiterIgnore | ( | cpArbiter * | arb | ) |
Causes a collision pair to be ignored as if you returned false from a begin callback. If called from a pre-step callback, you will still need to return false if you want it to be ignored in the current step.
Returns true if this is the first step a pair of objects started colliding.
Calculate the total impulse that was applied by this arbiter. This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
Calculate the total impulse including the friction that was applied by this arbiter. This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.