Chipmunk2D Pro API Reference
6.1.5
|
The cpArbiter struct controls pairs of colliding shapes. More...
Classes | |
struct | cpArbiter |
A colliding pair of shapes. More... | |
struct | cpContactPointSet |
A struct that wraps up the important collision data for an arbiter. More... | |
Macros | |
#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) |
Collision begin event function callback type. More... | |
typedef cpBool(* | cpCollisionPreSolveFunc )(cpArbiter *arb, cpSpace *space, void *data) |
Collision pre-solve event function callback type. More... | |
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. | |
typedef struct cpContactPointSet | cpContactPointSet |
A struct that wraps up the important collision data for an arbiter. | |
Functions | |
cpVect | cpArbiterTotalImpulse (const cpArbiter *arb) |
Calculate the total impulse that was applied by this arbiter. More... | |
cpVect | cpArbiterTotalImpulseWithFriction (const cpArbiter *arb) |
Calculate the total impulse including the friction that was applied by this arbiter. More... | |
cpFloat | cpArbiterTotalKE (const cpArbiter *arb) |
Calculate the amount of energy lost in a collision including static, but not dynamic friction. More... | |
void | cpArbiterIgnore (cpArbiter *arb) |
Causes a collision pair to be ignored as if you returned false from a begin callback. More... | |
static void | cpArbiterGetShapes (const cpArbiter *arb, cpShape **a, cpShape **b) |
Return the colliding shapes involved for this arbiter. More... | |
static void | cpArbiterGetBodies (const cpArbiter *arb, cpBody **a, cpBody **b) |
Return the colliding bodies involved for this arbiter. More... | |
cpContactPointSet | cpArbiterGetContactPointSet (const cpArbiter *arb) |
Return a contact set from an arbiter. | |
void | cpArbiterSetContactPointSet (cpArbiter *arb, cpContactPointSet *set) |
Replace the contact point set for an arbiter. More... | |
cpBool | cpArbiterIsFirstContact (const cpArbiter *arb) |
Returns true if this is the first step a pair of objects started colliding. | |
int | cpArbiterGetCount (const cpArbiter *arb) |
Get the number of contact points for this 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.
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.
Collision pre-solve event function callback type.
Returning false from a pre-step callback causes the collision to be ignored until the next step.
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.
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.
void cpArbiterSetContactPointSet | ( | cpArbiter * | arb, |
cpContactPointSet * | set | ||
) |
Replace the contact point set for an arbiter.
This can be a very powerful feature, but use it with caution!
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.