public class PrismaticJoint

  1. Object
  2. Joint
  3. PrismaticJoint
A prismatic joint. This joint provides one degree of freedom: translation along an axis fixed in bodyA. Relative rotation is prevented. You can use a joint limit to restrict the range of motion and a joint motor to drive the motion or to model joint friction.

Fields

protected final Vec2 m_localAnchorA
protected final Vec2 m_localAnchorB
protected final Vec2 m_localXAxisA
protected final Vec2 m_localYAxisA
protected float m_referenceAngle

Constructors

protected PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def)

Methods

public Vec2 getLocalAnchorA()
public Vec2 getLocalAnchorB()
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 float getJointSpeed()Get the current joint translation, usually in meters.
public float getJointTranslation()
public boolean isLimitEnabled()Is the joint limit enabled?
public void enableLimit(boolean flag)Enable/disable the joint limit.
public float getLowerLimit()Get the lower joint limit, usually in meters.
public float getUpperLimit()Get the upper joint limit, usually in meters.
public void setLimits(float lower, float upper)Set the joint limits, usually in meters.
public boolean isMotorEnabled()Is the joint motor enabled?
public void enableMotor(boolean flag)Enable/disable the joint motor.
public void setMotorSpeed(float speed)Set the motor speed, usually in meters per second.
public float getMotorSpeed()Get the motor speed, usually in meters per second.
public void setMaxMotorForce(float force)Set the maximum motor force, usually in N.
public float getMotorForce(float inv_dt)Get the current motor force, usually in N.
public float getMaxMotorForce()
public float getReferenceAngle()
public Vec2 getLocalAxisA()
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

Field details

m_localAnchorA

protected final Vec2 m_localAnchorA

m_localAnchorB

protected final Vec2 m_localAnchorB

m_localXAxisA

protected final Vec2 m_localXAxisA

m_localYAxisA

protected final Vec2 m_localYAxisA

m_referenceAngle

protected float m_referenceAngle

Constructor details

PrismaticJoint

protected PrismaticJoint(IWorldPool argWorld, PrismaticJointDef def)

Method details

getLocalAnchorA

public Vec2 getLocalAnchorA()

getLocalAnchorB

public Vec2 getLocalAnchorB()

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.

getJointSpeed

public float getJointSpeed()
Get the current joint translation, usually in meters.

getJointTranslation

public float getJointTranslation()

isLimitEnabled

public boolean isLimitEnabled()
Is the joint limit enabled?

enableLimit

public void enableLimit(boolean flag)
Enable/disable the joint limit.

getLowerLimit

public float getLowerLimit()
Get the lower joint limit, usually in meters.

getUpperLimit

public float getUpperLimit()
Get the upper joint limit, usually in meters.

setLimits

public void setLimits(float lower, float upper)
Set the joint limits, usually in meters.

isMotorEnabled

public boolean isMotorEnabled()
Is the joint motor enabled?

enableMotor

public void enableMotor(boolean flag)
Enable/disable the joint motor.

setMotorSpeed

public void setMotorSpeed(float speed)
Set the motor speed, usually in meters per second.

getMotorSpeed

public float getMotorSpeed()
Get the motor speed, usually in meters per second.

setMaxMotorForce

public void setMaxMotorForce(float force)
Set the maximum motor force, usually in N.

getMotorForce

public float getMotorForce(float inv_dt)
Get the current motor force, usually in N.

getMaxMotorForce

public float getMaxMotorForce()

getReferenceAngle

public float getReferenceAngle()

getLocalAxisA

public Vec2 getLocalAxisA()

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.