GearConstraint Class
Constrains the angle of two bodies to each other to be equal. If a gear ratio is not one, the angle of bodyA must be a multiple of the angle of bodyB.
Constructor
GearConstraint
(
-
bodyA
-
bodyB
-
[options]
Parameters:
Example:
var constraint = new GearConstraint(bodyA, bodyB);
world.addConstraint(constraint);
var constraint = new GearConstraint(bodyA, bodyB, {
ratio: 2,
maxTorque: 1000
});
world.addConstraint(constraint);
Item Index
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
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.
type
Number
The type of constraint. May be one of Constraint.DISTANCE, Constraint.GEAR, Constraint.LOCK, Constraint.PRISMATIC or Constraint.REVOLUTE.