Chipmunk2D Pro API Reference
7.0.1
|
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 | |
CP_EXPORT cpFloat | cpArbiterGetRestitution (const cpArbiter *arb) |
Get the restitution (elasticity) that will be applied to the pair of colliding objects. | |
CP_EXPORT void | cpArbiterSetRestitution (cpArbiter *arb, cpFloat restitution) |
Override the restitution (elasticity) that will be applied to the pair of colliding objects. | |
CP_EXPORT cpFloat | cpArbiterGetFriction (const cpArbiter *arb) |
Get the friction coefficient that will be applied to the pair of colliding objects. | |
CP_EXPORT void | cpArbiterSetFriction (cpArbiter *arb, cpFloat friction) |
Override the friction coefficient that will be applied to the pair of colliding objects. | |
CP_EXPORT cpDataPointer | cpArbiterGetUserData (const cpArbiter *arb) |
Get the user data pointer associated with this pair of colliding objects. | |
CP_EXPORT void | cpArbiterSetUserData (cpArbiter *arb, cpDataPointer userData) |
Set a user data point associated with this pair of colliding objects. More... | |
CP_EXPORT cpVect | cpArbiterTotalImpulse (const cpArbiter *arb) |
Calculate the total impulse including the friction that was applied by this arbiter. More... | |
CP_EXPORT cpFloat | cpArbiterTotalKE (const cpArbiter *arb) |
Calculate the amount of energy lost in a collision including static, but not dynamic friction. More... | |
CP_EXPORT cpBool | cpArbiterIgnore (cpArbiter *arb) |
Mark a collision pair to be ignored until the two objects separate. More... | |
CP_EXPORT void | cpArbiterGetShapes (const cpArbiter *arb, cpShape **a, cpShape **b) |
Return the colliding shapes involved for this arbiter. More... | |
CP_EXPORT void | cpArbiterGetBodies (const cpArbiter *arb, cpBody **a, cpBody **b) |
Return the colliding bodies involved for this arbiter. More... | |
CP_EXPORT cpContactPointSet | cpArbiterGetContactPointSet (const cpArbiter *arb) |
Return a contact set from an arbiter. | |
CP_EXPORT void | cpArbiterSetContactPointSet (cpArbiter *arb, cpContactPointSet *set) |
Replace the contact point set for an arbiter. More... | |
CP_EXPORT cpBool | cpArbiterIsFirstContact (const cpArbiter *arb) |
Returns true if this is the first step a pair of objects started colliding. | |
CP_EXPORT cpBool | cpArbiterIsRemoval (const cpArbiter *arb) |
Returns true if the separate callback is due to a shape being removed from the space. | |
CP_EXPORT int | cpArbiterGetCount (const cpArbiter *arb) |
Get the number of contact points for this arbiter. | |
CP_EXPORT cpVect | cpArbiterGetNormal (const cpArbiter *arb) |
Get the normal of the collision. | |
CP_EXPORT cpVect | cpArbiterGetPointA (const cpArbiter *arb, int i) |
Get the position of the ith contact point on the surface of the first shape. | |
CP_EXPORT cpVect | cpArbiterGetPointB (const cpArbiter *arb, int i) |
Get the position of the ith contact point on the surface of the second shape. | |
CP_EXPORT cpFloat | cpArbiterGetDepth (const cpArbiter *arb, int i) |
Get the depth of the ith contact point. | |
CP_EXPORT 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... | |
CP_EXPORT 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... | |
CP_EXPORT 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... | |
CP_EXPORT 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... | |
CP_EXPORT 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. | |
CP_EXPORT 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. | |
CP_EXPORT 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. | |
CP_EXPORT 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.
CP_EXPORT 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!
CP_EXPORT 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.