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

public Class RevoluteJointDef

extends JointDef
Class Inheritance
Imports
com.badlogic.gdx.math.Vector2, com.badlogic.gdx.physics.box2d.Body, .JointDef

Revolute joint definition. This requires defining an anchor point where the bodies are joined. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. You also need to specify the initial relative angle for joint limits. This helps when saving and loading a game. The local anchor points are measured from the body's origin rather than the center of mass because: 1. you might not know where the center of mass will be. 2. if you add/remove shapes from a body and recompute the mass, the joints will be broken.

Field Summary

Modifier and TypeField and Description
public boolean
enableLimit

A flag to enable joint limits.

public boolean
enableMotor

A flag to enable the joint motor.

public final Vector2
localAnchorA

The local anchor point relative to body1's origin.

public final Vector2
localAnchorB

The local anchor point relative to body2's origin.

public float
lowerAngle

The lower angle for the joint limit (radians).

public float
maxMotorTorque

The maximum motor torque used to achieve the desired motor speed.

public float
motorSpeed

The desired motor speed.

public float
referenceAngle

The body2 angle minus body1 angle in the reference state (radians).

public float
upperAngle

The upper angle for the joint limit (radians).

Inherited from com.badlogic.gdx.physics.box2d.JointDef:
bodyAbodyBcollideConnectedtype

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
initialize(Body bodyA, Body bodyB, Vector2 anchor)

Initialize the bodies, anchors, and reference angle using a world anchor point.

Field Detail

enableLimitback to summary
public boolean enableLimit

A flag to enable joint limits.

enableMotorback to summary
public boolean enableMotor

A flag to enable the joint motor.

localAnchorAback to summary
public final Vector2 localAnchorA

The local anchor point relative to body1's origin.

localAnchorBback to summary
public final Vector2 localAnchorB

The local anchor point relative to body2's origin.

lowerAngleback to summary
public float lowerAngle

The lower angle for the joint limit (radians).

maxMotorTorqueback to summary
public float maxMotorTorque

The maximum motor torque used to achieve the desired motor speed. Usually in N-m.

motorSpeedback to summary
public float motorSpeed

The desired motor speed. Usually in radians per second.

referenceAngleback to summary
public float referenceAngle

The body2 angle minus body1 angle in the reference state (radians).

upperAngleback to summary
public float upperAngle

The upper angle for the joint limit (radians).

Constructor Detail

RevoluteJointDefback to summary
public RevoluteJointDef()

Method Detail

initializeback to summary
public void initialize(Body bodyA, Body bodyB, Vector2 anchor)

Initialize the bodies, anchors, and reference angle using a world anchor point.