Skip to main content

Function: resolveCollision()

resolveCollision(manifold, restingVelocityThreshold, applyRestitution, reverseContactOrder?): void

Defined in: physics/collision/resolve-collision.ts:82

Resolves a collision between two RigidBody instances by applying impulse-based normal and friction responses at each contact point, then correcting any residual penetration.

Parameters

manifold

CollisionManifold

The CollisionManifold describing the collision.

restingVelocityThreshold

number

Contacts with a relative normal velocity below this magnitude have their restitution treated as zero. This prevents resting bodies from perpetually bouncing as gravity re-introduces a small normal velocity each step that restitution would otherwise amplify back into motion.

applyRestitution

boolean

Whether restitution should be applied for this pass. Restitution models a single bounce event and should only be applied on the first of PhysicsWorld's solver iterations; applying it on every iteration lets contacts repeatedly "bounce" off each other within a single step, injecting energy that shows up as persistent jitter in resting piles.

reverseContactOrder?

boolean = false

Returns

void