crashcat docs
    Preparing search index...

    Function estimateCollisionResponse

    • Estimate the contact and friction impulses of a collision, and the body velocities they leave, before the solver runs: for the strength of an impact in onContactAdded, to play a sound or spawn particles. Accurate when two bodies collide, not when more collide at once, as it knows only this contact.

      Parameters

      • result: CollisionEstimationResult

        result object to write to

      • body1: RigidBody

        first body

      • body2: RigidBody

        second body

      • manifold: ContactManifold

        contact manifold

      • settings: ContactSettings

        the contact's settings: its materials, mass and inertia scales and surface velocities (a sensor has no response)

      • minVelocityForRestitution: number = 1.0

        minimum relative velocity to apply restitution (default 1.0 m/s)

      • numIterations: number = 10

        number of PGS iterations (default 10); with 1, no friction is calculated

      Returns void