# Class RollerCollision

Collision used by RollerFlightSim.

## Properties

accuracy_: number = 0.005

the collision distance accuracy: how close we must be to the moment of collision in order to be able to handle it.

distance_: number = NaN

depth of collision, negative = penetration

impulse: number = NaN

amount of impulse applied during collision

velocity: number = NaN

relative normal velocity between the two collision points

## Methods

• Returns true if this represents a bilateral constraint which can both push and pull; for example a Joint between two objects.

#### Returns boolean

true if this is a bilateral constraint

• Whether close enough to the point when this Collision can be handled. The `allowTiny` parameter exists because of cases where a small distance collision cannot be backed-up in time to get near to the preferred target 'half gap' distance.

#### Parameters

• ##### _allowTiny: boolean

regard as 'close enough' Collisions that have smaller distance than distance accuracy would normally allow

#### Returns boolean

true if close enough to the point when this Collision can be handled.

• Returns true if this is a stable contact: the objects are touching but not colliding.

#### Returns boolean

true if this is a stable contact

• Returns the distance between the objects. Negative distance means the objects are interpenetrating.

#### Returns number

the distance between the objects

• Returns the estimated time when this Collision should be handled by firing an impulse.

#### Returns number

the estimated time when this Collision should be handled or `NaN` if unknown.

• Returns size of impulse (change in momentum) that was applied to this Collision.

#### Returns number

size of impulse that was applied to this Collision, or NaN if no impulse applied.

• Returns the relative normal velocity between the two collision points. Negative velocity means the objects are colliding, positive means they are separating.

#### Returns number

relative normal velocity between the two collision points, negative means colliding

• Returns true if this represents an illegal state, typically because objects are interpenetrating.

#### Returns boolean

true if this represents an illegal state

• Returns true if this represents a collision state, generally when two objects are interpenetrating. The collision search mechanism implemented by AdvanceStrategy.advance operates to set the simulation at a time very close to but just before any Collision is happening, see getEstimatedTime.

#### Returns boolean

`true` if this represents a collision state

• Whether the distance is small enough that the objects are touching each other so that impulses can be transmitted.

#### Returns boolean

whether the objects are touching each other

• Returns true if this Collision needs to be resolved, such as by applying an impulse to reverse the velocities of the objects. This remains `true` even after backing up in time.

#### Returns boolean

true if this Collision needs to be resolved

• Mark this Collision as one that needs handling because it is has caused the collision engine to backup in time in order to resolve this Collision. This is useful because after backing up in time, a Collision may no longer report itself as isColliding.

#### Parameters

• ##### needsHandling: boolean

true if this Collision needs to be resolved

#### Returns void

• Updates the information in this Collision to reflect current position and velocity of bodies. This is used after backing up in time to the moment before the collision.

#### Parameters

• ##### _time: number

the current simulation time

#### Returns void

Generated using TypeDoc