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

Constructor

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

Create a gear joint

Parameters:
NameTypeAttributesDefaultDescription
objectABox2dObject
objectBBox2dObject
joint1Box2dJoint
joint2Box2dJoint
ratioratio<optional>
1

Extends

Methods

destroy()

Destroy this joint

getAnchorA() → {Vector2}

Get the first anchor for this joint in world coordinates

Returns:
Type: 
Vector2

getAnchorB() → {Vector2}

Get the second anchor for this joint in world coordinates

Returns:
Type: 
Vector2

getCollideConnected() → {boolean}

Check if the connected bodies should collide

Returns:
Type: 
boolean

getJoint1() → {Box2dJoint}

Get the first joint

Returns:
Type: 
Box2dJoint

getJoint2() → {Box2dJoint}

Get the second joint

Returns:
Type: 
Box2dJoint

getObjectA() → {Box2dObject}

Get the first object attached to this joint

Returns:
Type: 
Box2dObject

getObjectB() → {Box2dObject}

Get the second object attached to this joint

Returns:
Type: 
Box2dObject

getRatio() → {number}

Get the gear ratio

Returns:
Type: 
number

getReactionForce(time) → {Vector2}

Get the reaction force on bodyB at the joint anchor given a time step

Parameters:
NameTypeDescription
timenumber
Returns:
Type: 
Vector2

getReactionTorque(time) → {number}

Get the reaction torque on bodyB in N*m given a time step

Parameters:
NameTypeDescription
timenumber
Returns:
Type: 
number

isActive() → {boolean}

Check if either connected body is active

Returns:
Type: 
boolean

setRatio(ratio)

Set the gear ratio

Parameters:
NameTypeDescription
rationumber