Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Constructors

constructor

  • Parameters

    • bodyA: Body
    • bodyB: Body
    • 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

axisA: Vec3

Rotation axis, defined locally in bodyA.

axisB

axisB: Vec3

Rotation axis, defined locally in bodyB.

bodyA

bodyA: Body

Body A.

bodyB

bodyB: Body

Body B.

collideConnected

collideConnected: boolean

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

equations

equations: Equation[]

Equations to be solved in this constraint.

pivotA

pivotA: Vec3

Pivot, defined locally in bodyA.

pivotB

pivotB: Vec3

Pivot, defined locally in bodyB.

Methods

disable

  • disable(): void

disableMotor

  • disableMotor(): void

enable

  • enable(): void

enableMotor

  • enableMotor(): void

setMotorMaxForce

  • setMotorMaxForce(maxForce: number): void

setMotorSpeed

  • setMotorSpeed(speed: number): void

update

  • update(): void