public abstract class Joint

  1. Object
  2. Joint

Known subtypesConstantVolumeJoint, DistanceJoint, FrictionJoint, GearJoint, MouseJoint, PrismaticJoint, PulleyJoint, RevoluteJoint, RopeJoint, WeldJoint, WheelJoint

The base joint class. Joints are used to constrain two bodies together in various fashions. Some joints also feature limits and motors.

Fields

public Joint m_prev
public Joint m_next
public JointEdge m_edgeA
public JointEdge m_edgeB
protected Body m_bodyA
protected Body m_bodyB
public boolean m_islandFlag
public Object m_userData
protected IWorldPool pool

Constructors

protected Joint(IWorldPool worldPool, JointDef def)

Methods

public static Joint create(World world, JointDef def)
public static void destroy(Joint joint)
public JointType getType()get the type of the concrete joint.
public final Body getBodyA()get the first body attached to this joint.
public final Body getBodyB()get the second body attached to this joint.
public abstract void getAnchorA(Vec2 out)get the anchor point on bodyA in world coordinates.
public abstract void getAnchorB(Vec2 out)get the anchor point on bodyB in world coordinates.
public abstract void getReactionForce(float inv_dt, Vec2 out)get the reaction force on body2 at the joint anchor in Newtons.
public abstract float getReactionTorque(float inv_dt)get the reaction torque on body2 in N*m.
public Joint getNext()get the next joint the world joint list.
public Object getUserData()get the user data pointer.
public void setUserData(Object data)Set the user data pointer.
public final boolean getCollideConnected()
public boolean isActive()Short-cut function to determine if either body is inactive.
public abstract void initVelocityConstraints(SolverData data)
public abstract void solveVelocityConstraints(SolverData data)
public abstract boolean solvePositionConstraints(SolverData data)This returns true if the position errors are within tolerance.
public void destructor()Override to handle destruction of joint

Inherited methods

Field details

m_prev

public Joint m_prev

m_next

public Joint m_next

m_edgeA

public JointEdge m_edgeA

m_edgeB

public JointEdge m_edgeB

m_bodyA

protected Body m_bodyA

m_bodyB

protected Body m_bodyB

m_islandFlag

public boolean m_islandFlag

m_userData

public Object m_userData

pool

protected IWorldPool pool

Constructor details

Joint

protected Joint(IWorldPool worldPool, JointDef def)

Method details

create

public static Joint create(World world, JointDef def)

destroy

public static void destroy(Joint joint)

getType

public JointType getType()
get the type of the concrete joint.

getBodyA

public final Body getBodyA()
get the first body attached to this joint.

getBodyB

public final Body getBodyB()
get the second body attached to this joint.

getAnchorA

public abstract void getAnchorA(Vec2 out)
get the anchor point on bodyA in world coordinates.

getAnchorB

public abstract void getAnchorB(Vec2 out)
get the anchor point on bodyB in world coordinates.

getReactionForce

public abstract void getReactionForce(float inv_dt, Vec2 out)
get the reaction force on body2 at the joint anchor in Newtons.

getReactionTorque

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

getNext

public Joint getNext()
get the next joint the world joint list.

getUserData

public Object getUserData()
get the user data pointer.

setUserData

public void setUserData(Object data)
Set the user data pointer.

getCollideConnected

public final boolean getCollideConnected()

isActive

public boolean isActive()
Short-cut function to determine if either body is inactive.

initVelocityConstraints

public abstract void initVelocityConstraints(SolverData data)

solveVelocityConstraints

public abstract void solveVelocityConstraints(SolverData data)

solvePositionConstraints

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

destructor

public void destructor()
Override to handle destruction of joint