Box2D. Box2dGearJoint

Box2D Gear Joint

  • A gear joint is used to connect two joints together
  • Either joint can be a revolute or prismatic joint
  • You specify a gear ratio to bind the motions together
  • joint1's angle or translation plus ratio times joint2's stays constant, angles clockwise like angle
  • It is destroyed along with either joint, or an object either joint is on
  • It turns objectB of each joint, so make each with its fixed or carrying object first, and a dynamic objectB

Constructor

new Box2dGearJoint(objectA, objectB, joint1, joint2, ratioopt)

Create a gear joint

Parameters:
NameTypeAttributesDefaultDescription
objectABox2dObject

objectB of joint1, Box2D joins that one whatever is passed

objectBBox2dObject

objectB of joint2, Box2D joins that one whatever is passed

joint1Box2dJoint
joint2Box2dJoint
rationumber<optional>
1

Extends

  • Box2dJoint

Methods

getJoint1() → {Box2dJoint}

Get the first joint

Returns:
Type: 
Box2dJoint

getJoint2() → {Box2dJoint}

Get the second joint

Returns:
Type: 
Box2dJoint

getRatio() → {number}

Get the gear ratio

Returns:
Type: 
number

setRatio(ratio)

Set the gear ratio

Parameters:
NameTypeDescription
rationumber