crashcat docs
    Preparing search index...

    Contact constraint for a body pair. Contains all contact points and shared constraint data.

    One ContactConstraint per active collision pair per frame. Can have 1-4 contact points. All contact points share the same normal/tangent directions and material properties.

    type ContactConstraint = {
        bodyIndexA: number;
        bodyIndexB: number;
        contactIndex: number;
        contactPoints: [
            WorldContactPoint,
            WorldContactPoint,
            WorldContactPoint,
            WorldContactPoint,
        ];
        friction: number;
        invInertiaA: Mat4;
        invInertiaB: Mat4;
        invInertiaScaleA: number;
        invInertiaScaleB: number;
        invMassA: number;
        invMassB: number;
        normal: Vec3;
        numContactPoints: number;
        restitution: number;
        sortKey: number;
        subShapeIdA: number;
        subShapeIdB: number;
        tangent1: Vec3;
        tangent2: Vec3;
    }
    Index

    Properties

    bodyIndexA: number

    index of first body in the contact constraint

    bodyIndexB: number

    index of second body in the contact constraint

    contactIndex: number

    index of the contact in the global contact array, used to look up contact for writing back solved impulses

    contactPoints: [
        WorldContactPoint,
        WorldContactPoint,
        WorldContactPoint,
        WorldContactPoint,
    ]

    pool of 4 contact points, only the first numContactPoints entries are valid

    friction: number

    combined friction coefficient, computed from both bodies' friction values. typical range: 0.0 (frictionless) to 1.0+ (high friction)

    invInertiaA: Mat4

    inverse inertia matrix of body A, used to compute angular impulse response. cached from body at constraint setup time

    invInertiaB: Mat4

    inverse mass matrix of body B, used to compute angular impulse response. cached from body at constraint setup time

    invInertiaScaleA: number

    inverse inertia scale for body A, applied during position constraint solving to override inertia

    invInertiaScaleB: number

    inverse inertia scale for body B, applied during position constraint solving to override inertia

    invMassA: number

    inverse mass of body A (1/massA), 0 if body is static. cached from body at constraint setup time

    invMassB: number

    inverse mass of body B (1/massB), 0 if body is static. cached from body at constraint setup time

    normal: Vec3

    normalized contact normal (points from A toward B), same for all 4 contact points in this manifold

    numContactPoints: number

    number of active contact points (0-4), used to track how many of the pre-allocated contactPoints are valid

    restitution: number

    combined restitution coefficient, controls bounce behavior. typical range: 0.0 (no bounce) to 1.0+ (perfect bounce)

    sortKey: number

    sort key for deterministic ordering

    subShapeIdA: number

    sub-shape ID of shape A

    subShapeIdB: number

    sub-shape ID of shape B

    tangent1: Vec3

    first tangent vector (perpendicular to normal), computed as: normalize(cross(normal, arbitrary_vector))

    tangent2: Vec3

    second tangent vector (perpendicular to normal and tangent1), computed as: cross(normal, tangent1)