public class MouseJoint

  1. Object
  2. Joint
  3. MouseJoint
A mouse joint is used to make a point on a body track a specified world point. This a soft constraint with a maximum force. This allows the constraint to stretch and without applying huge forces. NOTE: this joint is not documented in the manual because it was developed to be used in the testbed. If you want to learn how to use the mouse joint, look at the testbed.

Constructors

protected MouseJoint(IWorldPool argWorld, MouseJointDef 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 invDt, Vec2 argOut)get the reaction force on body2 at the joint anchor in Newtons.
public float getReactionTorque(float invDt)get the reaction torque on body2 in N*m.
public void setTarget(Vec2 target)
public Vec2 getTarget()
public void setMaxForce(float force)
public float getMaxForce()
public void setFrequency(float hz)
public float getFrequency()
public void setDampingRatio(float ratio)
public float getDampingRatio()
public void initVelocityConstraints(SolverData data)
public boolean solvePositionConstraints(SolverData data)This returns true if the position errors are within tolerance.
public void solveVelocityConstraints(SolverData data)

Inherited fields

Inherited methods

Constructor details

MouseJoint

protected MouseJoint(IWorldPool argWorld, MouseJointDef 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 invDt, Vec2 argOut)
get the reaction force on body2 at the joint anchor in Newtons.

getReactionTorque

public float getReactionTorque(float invDt)
get the reaction torque on body2 in N*m.

setTarget

public void setTarget(Vec2 target)

getTarget

public Vec2 getTarget()

setMaxForce

public void setMaxForce(float force)

getMaxForce

public float getMaxForce()

setFrequency

public void setFrequency(float hz)

getFrequency

public float getFrequency()

setDampingRatio

public void setDampingRatio(float ratio)

getDampingRatio

public float getDampingRatio()

initVelocityConstraints

public void initVelocityConstraints(SolverData data)

solvePositionConstraints

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

solveVelocityConstraints

public void solveVelocityConstraints(SolverData data)