crashcat docs
    Preparing search index...

    Type Alias SwingTwistConstraint

    SwingTwistConstraint: ConstraintBase & {
        constraintToBody1: Quat;
        constraintToBody2: Quat;
        localSpacePosition1: Vec3;
        localSpacePosition2: Vec3;
        maxFrictionTorque: number;
        motorConstraintParts: [
            AngleConstraintPart,
            AngleConstraintPart,
            AngleConstraintPart,
        ];
        normalHalfConeAngle: number;
        planeHalfConeAngle: number;
        pointConstraintPart: PointConstraintPart;
        swingMotorSettings: motorSettings.MotorSettings;
        swingMotorState: motorSettings.MotorState;
        swingTwistConstraintPart: SwingTwistConstraintPart;
        targetAngularVelocity: Vec3;
        targetOrientation: Quat;
        twistMaxAngle: number;
        twistMinAngle: number;
        twistMotorSettings: motorSettings.MotorSettings;
        twistMotorState: motorSettings.MotorState;
        worldSpaceMotorAxis: [Vec3, Vec3, Vec3];
    }

    SwingTwistConstraint is a sophisticated constraint for humanoid ragdoll joints. It allows limited rotation with separate swing and twist limits.

    • Swing: rotation around Y and Z axes, limited by cone or pyramid shape
    • Twist: rotation around X axis (the twist axis), limited by min/max angles

    Type Declaration

    • constraintToBody1: Quat

      transform from constraint space to body 1 space

    • constraintToBody2: Quat

      transform from constraint space to body 2 space

    • 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 (N*m) when not powered by motor

    • motorConstraintParts: [AngleConstraintPart, AngleConstraintPart, AngleConstraintPart]

      motor constraint parts (twist=0, swingY=1, swingZ=2)

    • normalHalfConeAngle: number

      normal half cone angle (radians) - swing limit around Z axis

    • planeHalfConeAngle: number

      plane half cone angle (radians) - swing limit around Y axis

    • pointConstraintPart: PointConstraintPart

      point constraint for translation (3 DOF)

    • swingMotorSettings: motorSettings.MotorSettings

      swing motor settings (spring + torque limits)

    • swingMotorState: motorSettings.MotorState

      swing motor state

    • swingTwistConstraintPart: SwingTwistConstraintPart

      swing-twist constraint part for rotation limits

    • targetAngularVelocity: Vec3

      target angular velocity in constraint space of body 2

    • targetOrientation: Quat

      target orientation in constraint space

    • twistMaxAngle: number

      maximum twist angle (radians), in [-PI, PI]

    • twistMinAngle: number

      minimum twist angle (radians), in [-PI, PI]

    • twistMotorSettings: motorSettings.MotorSettings

      twist motor settings (spring + torque limits)

    • twistMotorState: motorSettings.MotorState

      twist motor state

    • worldSpaceMotorAxis: [Vec3, Vec3, Vec3]

      world space motor axes (X, Y, Z)