class nape.dynamics.Contact

Available on all platforms

Contact point for collision interactions *

* These objects are automatically reused and you should not keep references to them.

Instance Fields

var arbiter:CollisionArbiter

Reference to the CollisionArbiter this contact belongs to

var fresh:Bool

Whether this contact is newly generated, or persistant from previous step.

var friction:Float

The specific coeffecient of friction for this contact. *

* This value is equal either to the static or dynamic friction coeffecient of the arbiter * based on the relative velocity at contact point. *

* This value cannot be set, though you may implicitly set it exactly by modifying * the arbiter to have the same static and dynamic friction in the PreListener.

var penetration:Float

Penetration of bodies along normal for this contact. *

* This value may be negative and corresponds to the penetration (if at all) * of the contact point before positional integration and error resolvement * took place (correct at time of pre-listeners).

var position:Vec2

The world-space position of contact. *

* This value corresponds to the position * of the contact point before positional integration and error resolvement * took place (correct at time of pre-listeners).

function new():Void

@private

function normalImpulse(?body:Body = null):Vec3

Evaluate normal reactive impulses for this contact for a given body. *

* If body argument is null, then the contact normal impulses will be returned instead * with no angular impulse derivable, the direction of this impulse will be the direction of the normal. *
* If body argument is not null, then this will return the actual impulse applied to that specific body * for this contact this will include angular impulses due to position of contact point and normal. * *

body

The Body to query normal impulse for. (default null) *

returns

The impulse applied to the given body, considering normal reactive forces. *

function rollingImpulse(?body:Body = null):Float

Evaluate rolling friction impulses for this contact for a given body. *

* If body argument is null, then the rolling impulse of this contact will be returned * instead of the angular impulse applied to the specific body as a result of the rolling impulse. * *

body

The Body to query rolling impulse for. (default null) *

returns

The angular impulse applied to the given body. *

function tangentImpulse(?body:Body = null):Vec3

Evaluate tangent impulses for this contact for a given body. *

* If body argument is null, then the contact friction impulses is returned with * no angular impulse derivable, the direction of this impulse will be against the relative * velocity of the first body against the second. *
* If the body argument is non-null, then the actual impulse applied to that body due to tangent * frictino impulses will be returned, including angular effects due to contact position and normal. *

* These tangent impulses correspond to the forces of static and dynamic friction for this contact. * *

body

The Body to query tangent impulse for. (default null) *

returns

The impulse applied to the given body, considering standard frictional forces. *

function toString():String

@private

function totalImpulse(?body:Body = null):Vec3

Evaluate total contact impulse for a given body. *

* If body argument is null, then this will return the sum of normal and tangent contact impulse, and the contact * rolling impulse. *
* When body argument is non-null, this impulse will be the actual change in (mass weighted) * velocity that this contact caused to the Body in the previous time step. * *

body

The Body to query total impulse for. (default null) *

returns

The impulse applied to the given body *