Contact point for collision interactions

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

Constructor

new()

@private

Variables

read onlyarbiter:CollisionArbiter

Reference to the CollisionArbiter this contact belongs to

read onlyfresh:Bool

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

read onlyfriction: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.

read onlypenetration: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).

read onlyposition: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).

@:value(null)zpp_inner:ZPP_Contact = null

@private

Methods

@:value({ body : null })normalImpulse(?body:Body):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.

Parameters:

body

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

Returns:

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

Throws:

#

If body is non-null, and unrelated to this Contact.

@:value({ body : null })rollingImpulse(?body:Body):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.

Parameters:

body

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

Returns:

The angular impulse applied to the given body.

Throws:

#

If body is non-null, and unrelated to this Contact.

@:value({ body : null })tangentImpulse(?body:Body):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.

Parameters:

body

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

Returns:

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

Throws:

#

If body is non-null, and unrelated to this Contact.

@:keeptoString():String

@private

@:value({ body : null })totalImpulse(?body:Body):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.

Parameters:

body

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

Returns:

The impulse applied to the given body

Throws:

#

If body is non-null, and unrelated to this Contact.