public class GearJoint
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: coordinate1 + ratio * coordinate2 =
constant The ratio can be negative or positive. If one joint is a revolute joint and the other
joint is a prismatic joint, then the ratio will have units of length or units of 1/length.
Warning. The revolute and prismatic joints must be attached to fixed bodies (which must be body1
on those joints).
Warning. You have to manually destroy the gear joint if joint1 or joint2 is destroyed.
Constructors
protected GearJoint(IWorldPool argWorldPool, GearJointDef def) |
Methods
public void getAnchorA(Vec2 argOut) | get the anchor point on bodyA in world coordinates. |
public void getAnchorB(Vec2 argOut) | get the anchor point on bodyB in world coordinates. |
public void getReactionForce(float inv_dt, Vec2 argOut) | get the reaction force on body2 at the joint anchor in Newtons. |
public float getReactionTorque(float inv_dt) | get the reaction torque on body2 in N*m. |
public void setRatio(float argRatio) | |
public float getRatio() | |
public void initVelocityConstraints(SolverData data) | |
public void solveVelocityConstraints(SolverData data) | |
public Joint getJoint1() | |
public Joint getJoint2() | |
public boolean solvePositionConstraints(SolverData data) | This returns true if the position errors are within tolerance. |
Inherited fields
From Joint
m_prev, m_next, m_edgeA, m_edgeB, m_bodyA, m_bodyB, m_islandFlag, m_userData, pool
Inherited methods
Constructor details
GearJoint
protected GearJoint(IWorldPool argWorldPool, GearJointDef def)Method details
getAnchorA
public void getAnchorA(Vec2 argOut)get the anchor point on bodyA in world coordinates.
getAnchorB
public void getAnchorB(Vec2 argOut)get the anchor point on bodyB in world coordinates.
getReactionForce
public void getReactionForce(float inv_dt, Vec2 argOut)get the reaction force on body2 at the joint anchor in Newtons.
getReactionTorque
public float getReactionTorque(float inv_dt)get the reaction torque on body2 in N*m.
setRatio
public void setRatio(float argRatio)getRatio
public float getRatio()initVelocityConstraints
public void initVelocityConstraints(SolverData data)solveVelocityConstraints
public void solveVelocityConstraints(SolverData data)getJoint1
public Joint getJoint1()getJoint2
public Joint getJoint2()solvePositionConstraints
public boolean solvePositionConstraints(SolverData data)This returns true if the position errors are within tolerance.