APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.physics.box2d.joints

public Class WheelJoint

extends Joint
Class Inheritance
Imports
com.badlogic.gdx.math.Vector2, com.badlogic.gdx.physics.box2d.Joint, .World

A wheel joint. This joint provides two degrees of freedom: translation along an axis fixed in body1 and rotation in the plane. You can use a joint limit to restrict the range of motion and a joint motor to drive the rotation or to model rotational friction. This joint is designed for vehicle suspensions.

Field Summary

Modifier and TypeField and Description
private final Vector2
private final Vector2
private final Vector2
private final float[]
Inherited from com.badlogic.gdx.physics.box2d.Joint:
addrjointEdgeAjointEdgeB

Constructor Summary

AccessConstructor and Description
public
WheelJoint(World world, long addr)

Method Summary

Modifier and TypeMethod and Description
public void
enableMotor(boolean flag)

Enable/disable the joint motor.

public float
getJointSpeed()

Get the current joint translation speed, usually in meters per second.

public float
getJointTranslation()

Get the current joint translation, usually in meters.

public Vector2
public Vector2
public Vector2
public float
public float
getMotorSpeed()

Get the motor speed, usually in radians per second.

public float
getMotorTorque(float invDt)

Get the current motor torque given the inverse time step, usually in N-m.

public float
public float
public boolean
isMotorEnabled()

Is the joint motor enabled?

private native void
jniEnableMotor(long addr, boolean flag)

private native float
jniGetJointSpeed(long addr)

private native float
private native void
jniGetLocalAnchorA(long addr, float[] anchor)

private native void
jniGetLocalAnchorB(long addr, float[] anchor)

private native void
jniGetLocalAxisA(long addr, float[] anchor)

private native float
private native float
jniGetMotorSpeed(long addr)

private native float
jniGetMotorTorque(long addr, float invDt)

private native float
private native float
private native boolean
jniIsMotorEnabled(long addr)

private native void
jniSetMaxMotorTorque(long addr, float torque)

private native void
jniSetMotorSpeed(long addr, float speed)

private native void
jniSetSpringDampingRatio(long addr, float ratio)

private native void
jniSetSpringFrequencyHz(long addr, float hz)

public void
setMaxMotorTorque(float torque)

Set/Get the maximum motor force, usually in N-m.

public void
setMotorSpeed(float speed)

Set the motor speed, usually in radians per second.

public void
setSpringDampingRatio(float ratio)

Set/Get the spring damping ratio

public void
setSpringFrequencyHz(float hz)

Set/Get the spring frequency in hertz.

Inherited from com.badlogic.gdx.physics.box2d.Joint:
getAnchorAgetAnchorBgetBodyAgetBodyBgetCollideConnectedgetReactionForcegetReactionTorquegetTypegetUserDataisActivesetUserData

Field Detail

localAnchorAback to summary
private final Vector2 localAnchorA
localAnchorBback to summary
private final Vector2 localAnchorB
localAxisAback to summary
private final Vector2 localAxisA
tmpback to summary
private final float[] tmp

Hides com.badlogic.gdx.physics.box2d.Joint.tmp.

Constructor Detail

WheelJointback to summary
public WheelJoint(World world, long addr)

Method Detail

enableMotorback to summary
public void enableMotor(boolean flag)

Enable/disable the joint motor.

getJointSpeedback to summary
public float getJointSpeed()

Get the current joint translation speed, usually in meters per second.

getJointTranslationback to summary
public float getJointTranslation()

Get the current joint translation, usually in meters.

getLocalAnchorAback to summary
public Vector2 getLocalAnchorA()
getLocalAnchorBback to summary
public Vector2 getLocalAnchorB()
getLocalAxisAback to summary
public Vector2 getLocalAxisA()
getMaxMotorTorqueback to summary
public float getMaxMotorTorque()
getMotorSpeedback to summary
public float getMotorSpeed()

Get the motor speed, usually in radians per second.

getMotorTorqueback to summary
public float getMotorTorque(float invDt)

Get the current motor torque given the inverse time step, usually in N-m.

getSpringDampingRatioback to summary
public float getSpringDampingRatio()
getSpringFrequencyHzback to summary
public float getSpringFrequencyHz()
isMotorEnabledback to summary
public boolean isMotorEnabled()

Is the joint motor enabled?

jniEnableMotorback to summary
private native void jniEnableMotor(long addr, boolean flag)
jniGetJointSpeedback to summary
private native float jniGetJointSpeed(long addr)
jniGetJointTranslationback to summary
private native float jniGetJointTranslation(long addr)
jniGetLocalAnchorAback to summary
private native void jniGetLocalAnchorA(long addr, float[] anchor)
jniGetLocalAnchorBback to summary
private native void jniGetLocalAnchorB(long addr, float[] anchor)
jniGetLocalAxisAback to summary
private native void jniGetLocalAxisA(long addr, float[] anchor)
jniGetMaxMotorTorqueback to summary
private native float jniGetMaxMotorTorque(long addr)
jniGetMotorSpeedback to summary
private native float jniGetMotorSpeed(long addr)
jniGetMotorTorqueback to summary
private native float jniGetMotorTorque(long addr, float invDt)
jniGetSpringDampingRatioback to summary
private native float jniGetSpringDampingRatio(long addr)
jniGetSpringFrequencyHzback to summary
private native float jniGetSpringFrequencyHz(long addr)
jniIsMotorEnabledback to summary
private native boolean jniIsMotorEnabled(long addr)
jniSetMaxMotorTorqueback to summary
private native void jniSetMaxMotorTorque(long addr, float torque)
jniSetMotorSpeedback to summary
private native void jniSetMotorSpeed(long addr, float speed)
jniSetSpringDampingRatioback to summary
private native void jniSetSpringDampingRatio(long addr, float ratio)
jniSetSpringFrequencyHzback to summary
private native void jniSetSpringFrequencyHz(long addr, float hz)
setMaxMotorTorqueback to summary
public void setMaxMotorTorque(float torque)

Set/Get the maximum motor force, usually in N-m.

setMotorSpeedback to summary
public void setMotorSpeed(float speed)

Set the motor speed, usually in radians per second.

setSpringDampingRatioback to summary
public void setSpringDampingRatio(float ratio)

Set/Get the spring damping ratio

setSpringFrequencyHzback to summary
public void setSpringFrequencyHz(float hz)

Set/Get the spring frequency in hertz. Setting the frequency to zero disables the spring.