Arbiter class
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.
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
- isFirstContact → bool
-
Returns true if this is the first step a pair of objects started colliding.
no setter
- isRemoval → bool
-
Returns true if the separate callback is due to a shape being removed from the space.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
callWildcardBeginA(
Space space) → bool - 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.
-
callWildcardBeginB(
Space space) → bool - 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.
-
callWildcardPostSolveA(
Space space) → void - If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly.
-
callWildcardPostSolveB(
Space space) → void - If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly.
-
callWildcardPreSolveA(
Space space) → bool - 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.
-
callWildcardPreSolveB(
Space space) → bool - 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.
-
callWildcardSeparateA(
Space space) → void - If you want a custom callback to invoke the wildcard callback for the first collision type, you must call this function explicitly.
-
callWildcardSeparateB(
Space space) → void - If you want a custom callback to invoke the wildcard callback for the second collision type, you must call this function explicitly.
-
getBodies(
) → (Body, Body) - Return the colliding bodies involved for this arbiter.
-
getContactPointSet(
) → ContactPointSet - Return a contact set from an arbiter.
-
getCount(
) → int - Get the number of contact points for this arbiter.
-
getData<
T> () → T? - Get the user data pointer associated with this pair of colliding objects.
-
getDepth(
int i) → double - Get the depth of the @c ith contact point.
-
getFriction(
) → double - Get the friction coefficient that will be applied to the pair of colliding objects.
-
getNormal(
) → Vector2 - Get the normal of the collision.
-
getPointA(
int i) → Vector2 - Get the position of the @c ith contact point on the surface of the first shape.
-
getPointB(
int i) → Vector2 - Get the position of the @c ith contact point on the surface of the second shape.
-
getRestitution(
) → double - Get the restitution (elasticity) that will be applied to the pair of colliding objects.
-
getShapes(
) → (Shape, Shape) - Return the colliding shapes involved for this arbiter.
-
getSurfaceVelocity(
) → Vector2 - Get the relative surface velocity of the two shapes in contact.
-
ignore(
) → bool - 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.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeData(
) → void - If you need to perform any cleanup for this data, you must do it yourself, in the separate callback for instance.
-
setContactPointSet(
ContactPointSet contactPointSet) → void - Replace the contact point set for an arbiter. This can be a very powerful feature, but use it with caution!
-
setData<
T> (T data) → void - Set a user data point associated with this pair of colliding objects.
-
setFriction(
double friction) → void - Override the friction coefficient that will be applied to the pair of colliding objects.
-
setRestitution(
double restitution) → void - Override the restitution (elasticity) that will be applied to the pair of colliding objects.
-
setSurfaceVelocity(
Vector2 vr) → void - Override the relative surface velocity of the two shapes in contact. By default this is calculated to be the difference of the two surface velocities clamped to the tangent plane.
-
toString(
) → String -
A string representation of this object.
inherited
-
totalImpulse(
) → Vector2 - 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.
-
totalKE(
) → double - 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.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override