crashcat docs
    Preparing search index...

    Type Alias ContactConstraint

    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 = {
        angularFrictionConstraint: angularFrictionConstraintPart.AngularFrictionConstraintPart;
        bodyIndexA: number;
        bodyIndexB: number;
        contactIndex: number;
        contactPoints: [
            WorldContactPoint,
            WorldContactPoint,
            WorldContactPoint,
            WorldContactPoint,
        ];
        friction: number;
        frictionConstraint1: axisConstraintPart.AxisConstraintPart;
        frictionConstraint2: axisConstraintPart.AxisConstraintPart;
        frictionPoint: Vec3;
        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

    angularFrictionConstraint: angularFrictionConstraintPart.AngularFrictionConstraintPart

    Angular friction constraint around the contact normal. Lambda clamping: |λ_angular| ≤ μ · Σ_i (distanceToFrictionCenter_i · normalLambda_i). Deactivated for single-contact manifolds.

    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)

    frictionConstraint1: axisConstraintPart.AxisConstraintPart

    Linear friction constraint along tangent1, anchored at frictionPoint. Lambda clamping (joint with frictionConstraint2): λ1² + λ2² ≤ (μ · Σ_i normalLambda_i)²

    frictionConstraint2: axisConstraintPart.AxisConstraintPart

    Linear friction constraint along tangent2, anchored at frictionPoint. Lambda clamping (joint with frictionConstraint1): λ1² + λ2² ≤ (μ · Σ_i normalLambda_i)²

    frictionPoint: Vec3

    Average contact point ("friction point") in world space — unweighted mean of contact midpoints. The two linear friction constraints are anchored at this point.

    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)