Chipmunk2D Pro API Reference
7.0.0
|
The cpArbiter struct tracks pairs of colliding shapes. More...
Classes | |
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. | |
Functions | |
cpFloat | cpArbiterGetRestitution (const cpArbiter *arb) |
Get the restitution (elasticity) that will be applied to the pair of colliding objects. | |
void | cpArbiterSetRestitution (cpArbiter *arb, cpFloat restitution) |
Override the restitution (elasticity) that will be applied to the pair of colliding objects. | |
cpFloat | cpArbiterGetFriction (const cpArbiter *arb) |
Get the friction coefficient that will be applied to the pair of colliding objects. | |
void | cpArbiterSetFriction (cpArbiter *arb, cpFloat friction) |
Override the friction coefficient that will be applied to the pair of colliding objects. | |
cpDataPointer | cpArbiterGetUserData (const cpArbiter *arb) |
Get the user data pointer associated with this pair of colliding objects. | |
void | cpArbiterSetUserData (cpArbiter *arb, cpDataPointer userData) |
Set a user data point associated with this pair of colliding objects. More... | |
cpVect | cpArbiterTotalImpulse (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... | |
cpBool | cpArbiterIgnore (cpArbiter *arb) |
Mark a collision pair to be ignored until the two objects separate. More... | |
void | cpArbiterGetShapes (const cpArbiter *arb, cpShape **a, cpShape **b) |
Return the colliding shapes involved for this arbiter. More... | |
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. | |
cpBool | cpArbiterIsRemoval (const cpArbiter *arb) |
Returns true if the separate callback is due to a shape being removed from the space. | |
int | cpArbiterGetCount (const cpArbiter *arb) |
Get the number of contact points for this arbiter. | |
cpVect | cpArbiterGetNormal (const cpArbiter *arb) |
Get the normal of the collision. | |
cpVect | cpArbiterGetPointA (const cpArbiter *arb, int i) |
Get the position of the ith contact point on the surface of the first shape. | |
cpVect | cpArbiterGetPointB (const cpArbiter *arb, int i) |
Get the position of the ith contact point on the surface of the second shape. | |
cpFloat | cpArbiterGetDepth (const cpArbiter *arb, int i) |
Get the depth of the ith contact point. | |
cpBool | cpArbiterCallWildcardBeginA (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly. More... | |
cpBool | cpArbiterCallWildcardBeginB (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly. More... | |
cpBool | cpArbiterCallWildcardPreSolveA (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly. More... | |
cpBool | cpArbiterCallWildcardPreSolveB (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly. More... | |
void | cpArbiterCallWildcardPostSolveA (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly. | |
void | cpArbiterCallWildcardPostSolveB (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly. | |
void | cpArbiterCallWildcardSeparateA (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly. | |
void | cpArbiterCallWildcardSeparateB (cpArbiter *arb, cpSpace *space) |
If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly. | |
The cpArbiter struct tracks pairs of colliding shapes.
They are also used in conjuction with collision handler callbacks allowing you to retrieve information on the collision or change it. A unique arbiter value is used for each pair of colliding objects. It persists until the shapes separate.
If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly.
You must decide how to handle the wildcard's return value since it may disagree with the other wildcard handler's return value or your own.
If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly.
You must decide how to handle the wildcard's return value since it may disagree with the other wildcard handler's return value or your own.
If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly.
You must decide how to handle the wildcard's return value since it may disagree with the other wildcard handler's return value or your own.
If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly.
You must decide how to handle the wildcard's return value since it may disagree with the other wildcard handler's return value or your own.
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.
Mark a collision pair to be ignored until the two objects separate.
Pre-solve and post-solve callbacks will not be called, but the separate callback will be called.
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!
void cpArbiterSetUserData | ( | cpArbiter * | arb, |
cpDataPointer | userData | ||
) |
Set a user data point associated with this pair of colliding objects.
If you need to perform any cleanup for this pointer, you must do it yourself, in the separate callback for instance.
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.