Package org.jbox2d.dynamics.joints
Class RevoluteJointDef
- java.lang.Object
-
- org.jbox2d.dynamics.joints.JointDef
-
- org.jbox2d.dynamics.joints.RevoluteJointDef
-
public class RevoluteJointDef extends 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:
- you might not know where the center of mass will be.
- if you add/remove shapes from a body and recompute the mass, the joints will be broken.
-
-
Field Summary
Fields Modifier and Type Field Description booleanenableLimitA flag to enable joint limits.booleanenableMotorA flag to enable the joint motor.Vec2localAnchorAThe local anchor point relative to body1's origin.Vec2localAnchorBThe local anchor point relative to body2's origin.floatlowerAngleThe lower angle for the joint limit (radians).floatmaxMotorTorqueThe maximum motor torque used to achieve the desired motor speed.floatmotorSpeedThe desired motor speed.floatreferenceAngleThe body2 angle minus body1 angle in the reference state (radians).floatupperAngleThe upper angle for the joint limit (radians).
-
Constructor Summary
Constructors Constructor Description RevoluteJointDef()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinitialize(Body b1, Body b2, Vec2 anchor)Initialize the bodies, anchors, and reference angle using the world anchor.
-
-
-
Field Detail
-
localAnchorA
public Vec2 localAnchorA
The local anchor point relative to body1's origin.
-
localAnchorB
public Vec2 localAnchorB
The local anchor point relative to body2's origin.
-
referenceAngle
public float referenceAngle
The body2 angle minus body1 angle in the reference state (radians).
-
enableLimit
public boolean enableLimit
A flag to enable joint limits.
-
lowerAngle
public float lowerAngle
The lower angle for the joint limit (radians).
-
upperAngle
public float upperAngle
The upper angle for the joint limit (radians).
-
enableMotor
public boolean enableMotor
A flag to enable the joint motor.
-
motorSpeed
public float motorSpeed
The desired motor speed. Usually in radians per second.
-
maxMotorTorque
public float maxMotorTorque
The maximum motor torque used to achieve the desired motor speed. Usually in N-m.
-
-