API Docs for: 0.4.0
Show:

RevoluteConstraint Class

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

Constructor

RevoluteConstraint

(
  • bodyA
  • pivotA
  • bodyB
  • pivotB
  • maxForce
)

Parameters:

  • bodyA Body
  • pivotA Float32Array

    The point relative to the center of mass of bodyA which bodyA is constrained to.

  • bodyB Body

    Body that will be constrained in a similar way to the same point as bodyA. We will therefore get sort of a link between bodyA and bodyB. If not specified, bodyA will be constrained to a static point.

  • pivotB Float32Array

    See pivotA.

  • maxForce Number

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

Methods

disableMotor

()

Disable the rotational motor

enableMotor

()

Enable the rotational motor

getMotorSpeed

() Number

Get the speed of the rotational constraint motor

Returns:

Number:

The current speed, or false if the motor is not enabled.

motorIsEnabled

() Boolean

Check if the motor is enabled.

Returns:

Boolean:

setMotorSpeed

(
  • speed
)

Set the speed of the rotational constraint motor

Parameters:

  • speed Number