Package org.jbox2d.dynamics.joints
Class RevoluteJointDef
java.lang.Object
org.jbox2d.dynamics.joints.JointDef
org.jbox2d.dynamics.joints.RevoluteJointDef
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
FieldsModifier and TypeFieldDescriptionboolean
A flag to enable joint limits.boolean
A flag to enable the joint motor.The local anchor point relative to body1's origin.The local anchor point relative to body2's origin.float
The lower angle for the joint limit (radians).float
The maximum motor torque used to achieve the desired motor speed.float
The desired motor speed.float
The body2 angle minus body1 angle in the reference state (radians).float
The upper angle for the joint limit (radians). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
initialize
(Body b1, Body b2, Vec2 anchor) Initialize the bodies, anchors, and reference angle using the world anchor.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
localAnchorA
The local anchor point relative to body1's origin. -
localAnchorB
The local anchor point relative to body2's origin. -
referenceAngle
public float referenceAngleThe body2 angle minus body1 angle in the reference state (radians). -
enableLimit
public boolean enableLimitA flag to enable joint limits. -
lowerAngle
public float lowerAngleThe lower angle for the joint limit (radians). -
upperAngle
public float upperAngleThe upper angle for the joint limit (radians). -
enableMotor
public boolean enableMotorA flag to enable the joint motor. -
motorSpeed
public float motorSpeedThe desired motor speed. Usually in radians per second. -
maxMotorTorque
public float maxMotorTorqueThe maximum motor torque used to achieve the desired motor speed. Usually in N-m.
-
-
Constructor Details
-
RevoluteJointDef
public RevoluteJointDef()
-
-
Method Details
-
initialize
Initialize the bodies, anchors, and reference angle using the world anchor.- Parameters:
b1
-b2
-anchor
-
-