RealisticSolver
Implements
Index
Constructors
constructor
Parameters
config: DeepRequired<{ contactSolveBias?: ContactSolveBias; maxPositionCorrection?: number; positionIterations?: number; slop?: number; steeringFactor?: number; velocityIterations?: number; warmStart?: boolean } | undefined>
Returns RealisticSolver
Properties
publicconfig
directionMap
distanceMap
idToContactConstraint
lastFrameContacts
Methods
getContactConstraints
Parameters
id: string
Returns ContactConstraintPoint[]
postSolve
Parameters
contacts: CollisionContact[]
emitEvents: boolean = true
whether
postcollision/aftercollisionresolvefire, only the last substep of a frame does
Returns void
preSolve
Prepares the contact constraints (effective masses, lever arms, restitution targets) and warm starts them
Parameters
contacts: CollisionContact[]
substep: number = 0
index of the substep within the frame,
precollision/beforecollisionresolveare only emitted on the first
Returns void
publicsolve
Solve the contacts for one physics (sub)step
Parameters
contacts: CollisionContact[]
optional_duration: number
length of the step in ms, unused but kept so
substep/substepCountline up positionally with the CollisionSolver interfacesubstep: number = 0
index of the substep within the frame, collision events are emitted on the first and last substep only
substepCount: number = 1
total substeps in the frame
Returns CollisionContact[]
solvePosition
Iteratively solve the position overlap constraint
Parameters
contacts: CollisionContact[]
Returns void
solveVelocity
Parameters
contacts: CollisionContact[]
Returns void
warmStart
Warm up body's based on previous frame contact points
Parameters
contacts: CollisionContact[]
Returns void
A collision solver figures out how to position colliders such that they are no longer overlapping
Solvers are executed in the order