LittleJS 1.28.0

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

Extends Box2dJoint

Constructor

new Box2dGearJoint(objectA, objectB, joint1, joint2, ratio)box2d.js:1751

Create a gear joint

objectA Box2dObject

objectB of joint1, Box2D joins that one whatever is passed

objectB Box2dObject

objectB of joint2, Box2D joins that one whatever is passed

joint1 Box2dJoint
joint2 Box2dJoint
ratio number optional, default 1

Members

Methods

Inherited from Box2dJoint

Members

The first joint geared, a revolute or prismatic joint

The second joint geared, a revolute or prismatic joint

Methods

getJoint1() → Box2dJointbox2d.js:1791

Get the first joint

getJoint2() → Box2dJointbox2d.js:1795

Get the second joint

getRatio() → numberbox2d.js:1803

Get the gear ratio

setRatio(ratio)box2d.js:1799

Set the gear ratio

ratio number