Data Structure used to listen for Collisions between Bodies.

Static variables

staticread onlydefaults:ListenerOptions

Variables

a:Either<Body, Array<Body>>

The first Body or Array of Bodies the listener checks each step.

b:Either<Body, Array<Body>>

The second Body or Array of Bodies the listener checks each step.

collisions:Array<Collision>

Store of the latest Collisions.

correction_threshold:Float

Threshold determining how close two separating bodies must be before position correction occurs. Helps reduce jitter.

last_collisions:Array<Collision>

Store of the Collisions from the Prior Frame.

percent_correction:Float

Percentage of correction along the collision normal to be applied to seperating bodies. Helps prevent objects sinking into each other.

@:optionaloptionalquadtree_results:Array<Collision>

Store of the latest quadtree query results

separate:Bool

Flag that determines if Collisions found by this listener should separate the Bodies. Defaults to true.

@:optionaloptionalcondition:(Body, Body, Array<CollisionData>) ‑> Bool

A callback function that allows extra logic to be run on a potential collision.

If it returns true, the collision is valid. Otherwise the collision is discarded and no physics resolution/collision callbacks occur

@:optionaloptionalenter:(Body, Body, Array<CollisionData>) ‑> Void

A callback function that is called on the first frame that a collision starts.

@:optionaloptionalexit:(Body, Body) ‑> Void

A callback function that is called when a collision between two Bodies ends.

@:optionaloptionalstay:(Body, Body, Array<CollisionData>) ‑> Void

A callback function that is called on frames when two Bodies are continuing to collide.