API Docs for: 0.5.0
Show:

GearConstraint Class

Connects two bodies at given offset points, letting them rotate relative to each other around this point.

Constructor

GearConstraint

(
  • bodyA
  • bodyB
  • [options]
)

Parameters:

  • bodyA Body
  • bodyB Body
  • [options] Object optional
    • [angle=0] Number optional

      Relative angle between the bodies.

    • [ratio=1] Number optional

      Gear ratio.

    • [maxTorque] Number optional

      Maximum torque to apply.

Methods

getMaxTorque

() Number

Get the max torque for the constraint.

Returns:

Number:

setMaxTorque

(
  • torque
)

Set the max torque for the constraint.

Parameters:

  • torque Number

setRelaxation

(
  • relaxation
)

Set relaxation for this constraint.

Parameters:

  • relaxation Number

setStiffness

(
  • stiffness
)

Set stiffness for this constraint.

Parameters:

  • stiffness Number

update

()

Updates the internal constraint parameters before solve.

Properties

angle

Number

The relative angle

bodyA

Body

First body participating in the constraint.

bodyB

Body

Second body participating in the constraint.

collideConnected

Boolean

Set to true if you want the connected bodies to collide.

Default: true

equations

Array

Equations to be solved in this constraint

ratio

Number

The gear ratio.