class nape.dynamics.CollisionArbiter extends Arbiter

Available on all platforms

Arbiter sub type for collision interactions.

Instance Fields

var contacts:ContactList

Set of contact points for the related pairs of shapes.

var dynamicFriction:Float

Coeffecient of combined dynamic friction for collision interaction. *

* The value is computed as the square root of the product of the Shape * Material's dynamicFriction coeffecients. *

* This value may be modified only during a PreListener, and once modified * will no longer be under Nape's control. Values must not be negative.

var elasticity:Float

Coeffecient of combined elasticity for collision interaction. *

* The value is computed as the average of the Shape Material's elasticities * clamped to be in the range [0,1] *

* This value may be modified only during a PreListener, and once modified * will no longer be under Nape's control. Values must be in the range 0 * to 1.

var normal:Vec2

Normal of contact for collision interaction. *

* This normal will always point from arbiter's shape1, towards shape2 and * corresponds to the direction of the normal before positional integration * and erorr resolvement took place (Correct at time of pre-listener).

var radius:Float

This radius property describes the sum of the circle's radii for the pair of shapes, with * a Polygon having 0 radius. This value is used in positional iterations to resolve penetrations * between the Shapes.

var referenceEdge1:Null<Edge>

The reference edge for the collision on the first Polygon * If the first shape in Arbiter is a Circle this value is null.

var referenceEdge2:Null<Edge>

The reference edge for the collision on the second Polygon * If the second shape in Arbiter is a Circle this value is null.

var rollingFriction:Float

Coeffecient of combined rolling friction for collision interaction. *

* The value is computed as the square root of the product of the Shape * Material's rollingFriction coeffecients. *

* This value may be modified only during a PreListener, and once modified * will no longer be under Nape's control. Values must not be negative.

var staticFriction:Float

Coeffecient of combined static friction for collision interaction. *

* The value is computed as the square root of the product of the Shape * Material's staticFriction coeffecients. *

* This value may be modified only during a PreListener, and once modified * will no longer be under Nape's control. Values must not be negative.

function new():Void

@private

function firstVertex():Bool

In the case that we have a Circle-Polygon collision, then this * function will return true, if the circle collided with the first * vertex of edge. *

* If both firstVertex() and secondVertex() are false, it indicates * the Circle collided with the edge. * *

returns

True if Circle collided with first reference vertex.

function normalImpulse(?body:Body = null, ?freshOnly:Bool = false):Vec3

Evaluate normal reactive impulses for collision interaction for a given body. *

* If body argument is null, then the sum of 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 * rather than simply the sum of contact normal impulses, this will include angular impulses due to * positions of contact points and normal. * *

body

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

freshOnly

If true, then only 'new' contact points will be considered in computation. * (default false) *

returns

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

function rollingImpulse(?body:Body = null, ?freshOnly:Bool = false):Float

Evaluate rolling friction impulses for collision interaction. *

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

body

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

freshOnly

If true, then only 'new' contact points will be considered in computation. * (default false) *

returns

The angular impulse applied to the given body. *

function secondVertex():Bool

Check if colliding Circle hit second vertex of reference edge. *

* In the case that we have a Circle-Polygon collision, then this * function will return true, if the circle collided with the second * vertex of edge. *

* If both firstVertex() and secondVertex() are false, it indicates * the Circle collided with the edge. * *

returns

True if Circle collided with second reference vertex.

function tangentImpulse(?body:Body = null, ?freshOnly:Bool = false):Vec3

Evaluate tangent impulses for collision interaction. *

* If body argument is null, then the sum of 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 positions and normal. *

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

body

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

freshOnly

If true, then only 'new' contact points will be considered in computation. * (default false) *

returns

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

function totalImpulse(?body:Body = null, ?freshOnly:Bool = false):Vec3

Evaluate total contact impulses for collision interaction. *

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

body

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

freshOnly

If true, then only 'new' contact points will be considered in computation. * (default false) *

returns

The impulse applied to the given body *