Arbiter sub type for collision interactions.

Constructor

new()

@private

Variables

read onlycontacts:ContactList

Set of contact points for the related pairs of shapes.

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.

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.

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

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

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

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

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.

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.

Methods

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.

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

Parameters:

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.

Throws:

#

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

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

Parameters:

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.

Throws:

#

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

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.

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

Parameters:

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.

Throws:

#

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

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

Parameters:

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

Throws:

#

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

Inherited Variables

Defined by Arbiter

read onlybody1:Body

The first body in Arbiter interaction.

It will always be the case that arb.shape1.body == arb.body1

read onlybody2:Body

The second body in Arbiter interaction.

It will always be the case that arb.shape2.body == arb.body2

read onlycollisionArbiter:Null<CollisionArbiter>

Fast equivalent to casting this object to a CollisionArbiter.

This value is null when this arbiter is not a collision type.

read onlyfluidArbiter:Null<FluidArbiter>

Fast equivalent to casting this object to a FluidArbiter.

This value is null when this arbiter is not a fluid type.

read onlyisSleeping:Bool

Flag representing arbiter sleep state.

When true, this arbiter is sleeping.

read onlyshape1:Shape

The first shape in Arbiter interaction.

It will always be the case that arb.shape1.id < arb.shape2.id

read onlyshape2:Shape

The second shape in Arbiter interaction.

It will always be the case that arb.shape1.id < arb.shape2.id

read onlystate:PreFlag

The interaction state of this Arbiter.

This flag will, except for in a PreListener handler, always be either ImmState.ACCEPT or ImmState.IGNORE
During a PreListener handler, you can query this property to see what the current state of the arbiter has been set to, and returning null from the handler will keep the state unchanged.

read onlytype:ArbiterType

The type of this Arbiter.

@:value(null)zpp_inner:ZPP_Arbiter = null

@private

Inherited Methods

Defined by Arbiter

inlineisCollisionArbiter():Bool

Equivalent to: arb.type == ArbiterType.COLLISION

Returns:

True if this Arbiter is a Collision type arbiter.

inlineisFluidArbiter():Bool

Equivalent to: arb.type == ArbiterType.FLUID

Returns:

True if this Arbiter is a Fluid type arbiter.

inlineisSensorArbiter():Bool

Equivalent to: arb.type == ArbiterType.SENSOR

Returns:

True if this Arbiter is a Sensor type arbiter.

@:keeptoString():String

@private