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
-
[options]
Parameters:
-
bodyA
Body -
pivotA
ArrayThe point relative to the center of mass of bodyA which bodyA is constrained to.
-
bodyB
BodyBody 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
ArraySee pivotA.
-
[options]
Object optional-
[maxForce]
Number optionalThe maximum force that should be applied to constrain the bodies.
-
Item Index
Methods
Methods
disableMotor
()
Disable the rotational motor
enableMotor
()
Enable the rotational motor
getMotorSpeed
()
Number
Get the speed of the rotational constraint motor
Returns:
The current speed, or false if the motor is not enabled.
motorIsEnabled
()
Boolean
Check if the motor is enabled.
Returns:
setMotorSpeed
-
speed
Set the speed of the rotational constraint motor
Parameters:
-
speed
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 constraint position.
collideConnected
Boolean
Set to true if you want the connected bodies to collide.
Default: true
equations
Array
Equations to be solved in this constraint
lowerLimit
Boolean
The lower limit on the constraint angle.
lowerLimitEnabled
Boolean
Set to true to enable lower limit
motorEnabled
Boolean
Indicates whether the motor is enabled. Use .enableMotor() to enable the constraint motor.
pivotA
Array
pivotB
Array
upperLimit
Boolean
The upper limit on the constraint angle.
upperLimitEnabled
Boolean
Set to true to enable upper limit