The cpArbiter struct controls pairs of colliding shapes. More...
Classes | |
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_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. | |
typedef cpBool(* | cpCollisionPreSolveFunc )(cpArbiter *arb, cpSpace *space, void *data) |
Collision pre-solve event function callback type. | |
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. | |
cpVect | cpArbiterTotalImpulseWithFriction (const cpArbiter *arb) |
Calculate the total impulse including the friction that was applied by this arbiter. | |
cpFloat | cpArbiterTotalKE (const cpArbiter *arb) |
Calculate the amount of energy lost in a collision including static, but not dynamic friction. | |
void | cpArbiterIgnore (cpArbiter *arb) |
Causes a collision pair to be ignored as if you returned false from a begin callback. | |
static void | cpArbiterGetShapes (const cpArbiter *arb, cpShape **a, cpShape **b) |
Return the colliding shapes involved for this arbiter. | |
static void | cpArbiterGetBodies (const cpArbiter *arb, cpBody **a, cpBody **b) |
Return the colliding bodies involved for this arbiter. | |
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.
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 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.
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.
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.
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.
cpFloat cpArbiterTotalKE | ( | const cpArbiter * | arb | ) |
Calculate the amount of energy lost in a collision including static, but not dynamic friction.
This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.