Arbiter sub type for collision interactions.
Constructor
Variables
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.
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. |
---|
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.
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. |
---|
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. |
---|