Class HingeConstraint

Hinge constraint. Think of it as a door hinge. It tries to keep the door in the correct place and with the correct orientation.

Hierarchy (view full)

Constructors

  • Parameters

    • bodyA: Body
    • bodyB: Body
    • Optional options: {
          axisA?: Vec3;
          axisB?: Vec3;
          collideConnected?: boolean;
          maxForce?: number;
          pivotA?: Vec3;
          pivotB?: Vec3;
      }
      • Optional axisA?: Vec3

        An axis that bodyA can rotate around, defined locally in bodyA.

      • Optional axisB?: Vec3

        An axis that bodyB can rotate around, defined locally in bodyB.

      • Optional collideConnected?: boolean

        Wheter to collide the connected bodies or not.

        Default

        false
        
      • Optional maxForce?: number

        The maximum force that should be applied to constrain the bodies.

        Default

        1e6
        
      • Optional pivotA?: Vec3

        A point defined locally in bodyA. This defines the offset of axisA.

      • Optional pivotB?: Vec3

        A point defined locally in bodyB. This defines the offset of axisB.

    Returns HingeConstraint

Properties

axisA: Vec3

Rotation axis, defined locally in bodyA.

axisB: Vec3

Rotation axis, defined locally in bodyB.

bodyA: Body

Body A.

bodyB: Body

Body B.

collideConnected: boolean

Set to false if you don't want the bodies to collide when they are connected.

equationX: ContactEquation
equationY: ContactEquation
equationZ: ContactEquation
equations: Equation[]

Equations to be solved in this constraint.

id: number
pivotA: Vec3

Pivot, defined locally in bodyA.

pivotB: Vec3

Pivot, defined locally in bodyB.

rotationalEquation1: RotationalEquation
rotationalEquation2: RotationalEquation
idCounter: number

Methods

  • disableMotor

    Returns void

  • enableMotor

    Returns void

  • setMotorMaxForce

    Parameters

    • maxForce: number

    Returns void

  • setMotorSpeed

    Parameters

    • speed: number

    Returns void