public class DistanceJoint

  1. Object
  2. Joint
  3. DistanceJoint
A distance joint constrains two points on two bodies to remain at a fixed distance from each other. You can view this as a massless, rigid rod.

Constructors

protected DistanceJoint(IWorldPool argWorld, DistanceJointDef def)

Methods

public void setFrequency(float hz)
public float getFrequency()
public float getLength()
public void setLength(float argLength)
public void setDampingRatio(float damp)
public float getDampingRatio()
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 Vec2 getLocalAnchorA()
public Vec2 getLocalAnchorB()
public void getReactionForce(float inv_dt, Vec2 argOut)Get the reaction force given the inverse time step.
public float getReactionTorque(float inv_dt)Get the reaction torque given the inverse time step.
public void initVelocityConstraints(SolverData data)
public void solveVelocityConstraints(SolverData data)
public boolean solvePositionConstraints(SolverData data)This returns true if the position errors are within tolerance.

Inherited fields

Inherited methods

Constructor details

DistanceJoint

protected DistanceJoint(IWorldPool argWorld, DistanceJointDef def)

Method details

setFrequency

public void setFrequency(float hz)

getFrequency

public float getFrequency()

getLength

public float getLength()

setLength

public void setLength(float argLength)

setDampingRatio

public void setDampingRatio(float damp)

getDampingRatio

public float getDampingRatio()

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.

getLocalAnchorA

public Vec2 getLocalAnchorA()

getLocalAnchorB

public Vec2 getLocalAnchorB()

getReactionForce

public void getReactionForce(float inv_dt, Vec2 argOut)
Get the reaction force given the inverse time step. Unit is N.

getReactionTorque

public float getReactionTorque(float inv_dt)
Get the reaction torque given the inverse time step. Unit is N*m. This is always zero for a distance joint.

initVelocityConstraints

public void initVelocityConstraints(SolverData data)

solveVelocityConstraints

public void solveVelocityConstraints(SolverData data)

solvePositionConstraints

public boolean solvePositionConstraints(SolverData data)
This returns true if the position errors are within tolerance.