API Docs for: 0.6.1
Show:

HingeConstraint Class

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

Constructor

HingeConstraint

(
  • bodyA
  • bodyB
  • [options]
)

Parameters:

  • bodyA Body
  • bodyB Body
  • [options] Object optional
    • [pivotA] Vec3 optional

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

    • [axisA] Vec3 optional

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

    • [pivotB] Vec3 optional
    • [axisB] Vec3 optional
    • [maxForce=1e6] Number optional

Methods

disable

()

Disables all equations in the constraint.

disableMotor

()

enable

()

Enables all equations in the constraint.

enableMotor

()

setMotorMaxForce

(
  • maxForce
)

Parameters:

  • maxForce Number

setMotorSpeed

(
  • speed
)

Parameters:

  • speed Number

update

()

Update all the equations with data.

Properties

axisA

Vec3

Rotation axis, defined locally in bodyA.

axisB

Vec3

Rotation axis, defined locally in bodyB.

collideConnected

Boolean

Set to true if you want the bodies to collide when they are connected.

equations

Array

Equations to be solved in this constraint

id

Number

pivotA

Vec3

Pivot, defined locally in bodyA.

pivotB

Vec3

Pivot, defined locally in bodyB.