crashcat docs
    Preparing search index...

    Type Alias HingeConstraint

    HingeConstraint: ConstraintBase & {
        hasLimits: boolean;
        invInitialOrientation: Quat;
        limitsMax: number;
        limitsMin: number;
        limitsSpringSettings: springSettings.SpringSettings;
        localSpaceHingeAxis1: Vec3;
        localSpaceHingeAxis2: Vec3;
        localSpaceNormalAxis1: Vec3;
        localSpaceNormalAxis2: Vec3;
        localSpacePosition1: Vec3;
        localSpacePosition2: Vec3;
        maxFrictionTorque: number;
        motorConstraintPart: AngleConstraintPart;
        motorSettings: motorSettings.MotorSettings;
        motorState: motorSettings.MotorState;
        pointConstraintPart: PointConstraintPart;
        rotationConstraintPart: HingeRotationConstraintPart;
        rotationLimitsConstraintPart: AngleConstraintPart;
        targetAngle: number;
        targetAngularVelocity: number;
        theta: number;
        worldSpaceHingeAxis1: Vec3;
    }

    Hinge constraint removes 5 DOF (3 translation + 2 rotation). Allows rotation only around the hinge axis, like a door hinge or wheel.

    Type Declaration

    • hasLimits: boolean

      whether angle limits are enabled

    • invInitialOrientation: Quat

      inverse of initial relative orientation, for calculating current angle

    • limitsMax: number

      maximum angle limit (radians)

    • limitsMin: number

      minimum angle limit (radians)

    • limitsSpringSettings: springSettings.SpringSettings

      spring settings for soft limits

    • localSpaceHingeAxis1: Vec3

      hinge axis on body 1 in local space (normalized)

    • localSpaceHingeAxis2: Vec3

      hinge axis on body 2 in local space (normalized)

    • localSpaceNormalAxis1: Vec3

      normal axis perpendicular to hinge on body 1 (for angle reference)

    • localSpaceNormalAxis2: Vec3

      normal axis perpendicular to hinge on body 2 (for angle reference)

    • localSpacePosition1: Vec3

      attachment point on body 1 in local space

    • localSpacePosition2: Vec3

      attachment point on body 2 in local space

    • maxFrictionTorque: number

      maximum friction torque when motor is off

    • motorConstraintPart: AngleConstraintPart

      motor constraint (1 DOF)

    • motorSettings: motorSettings.MotorSettings

      motor settings (spring + torque limits)

    • motorState: motorSettings.MotorState

      motor state

    • pointConstraintPart: PointConstraintPart

      point constraint for translation (3 DOF)

    • rotationConstraintPart: HingeRotationConstraintPart

      hinge rotation constraint (2 DOF) - keeps axes aligned

    • rotationLimitsConstraintPart: AngleConstraintPart

      angle limit constraint (1 DOF)

    • targetAngle: number

      target angle (radians) for position mode

    • targetAngularVelocity: number

      target angular velocity (rad/s) for velocity mode

    • theta: number

      current hinge angle (radians) - cached during setup

    • worldSpaceHingeAxis1: Vec3

      world space hinge axis (cached during setup)