HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
|
Revolute joint definition
More...
Public Member Functions | |
RevoluteJointDef (Body bodyA, Body bodyB, Vec2 anchorA, Vec2 anchorB, float referenceAngle=0.0f, bool enableSpring=false, float hertz=0.0f, float dampingRatio=0.0f, bool enableLimit=false, float lowerAngle=0.0f, float upperAngle=0.0f, bool enableMotor=false, float maxMotorTorque=0.0f, float motorSpeed=0.0f, bool collideConnected=false, object? userData=null) | |
Construct a revolute joint definition with the supplied values. | |
RevoluteJointDef () | |
Construct a revolute joint definition with the default values. | |
Properties | |
ref Body | BodyA [get] |
The first attached body. | |
ref Body | BodyB [get] |
The second attached body. | |
ref Vec2 | LocalAnchorA [get] |
The local anchor point relative to bodyA's origin. | |
ref Vec2 | LocalAnchorB [get] |
The local anchor point relative to bodyB's origin. | |
ref float | ReferenceAngle [get] |
The bodyB angle minus bodyA angle in the reference state (radians). This defines the zero angle for the joint limit. | |
bool | EnableSpring [get, set] |
Enable a rotational spring on the revolute hinge axis. | |
ref float | Hertz [get] |
The spring stiffness Hertz, cycles per second. | |
ref float | DampingRatio [get] |
The spring damping ratio, non-dimensional. | |
bool | EnableLimit [get, set] |
A flag to enable joint limits. | |
ref float | LowerAngle [get] |
The lower angle for the joint limit in radians. Minimum of -0.95*pi radians. | |
ref float | UpperAngle [get] |
The upper angle for the joint limit in radians. Maximum of 0.95*pi radians. | |
bool | EnableMotor [get, set] |
A flag to enable the joint motor. | |
ref float | MaxMotorTorque [get] |
The maximum motor torque, typically in newton-meters. | |
ref float | MotorSpeed [get] |
The desired motor speed in radians per second. | |
ref float | DrawSize [get] |
Scale the debug draw. | |
bool | CollideConnected [get, set] |
Set this flag to true if the attached bodies should collide. | |
object? | UserData [get, set] |
User data. | |
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:
|
inline |
Construct a revolute joint definition with the supplied values.
bodyA | The first attached body |
bodyB | The second attached body |
anchorA | The local anchor point relative to bodyA's origin |
anchorB | The local anchor point relative to bodyB's origin |
referenceAngle | The bodyB angle minus bodyA angle in the reference state (radians) |
enableSpring | Enable a rotational spring on the revolute hinge axis |
hertz | The spring stiffness Hertz, cycles per second |
dampingRatio | The spring damping ratio, non-dimensional |
enableLimit | A flag to enable joint limits |
lowerAngle | The lower angle for the joint limit in radians |
upperAngle | The upper angle for the joint limit in radians |
enableMotor | A flag to enable the joint motor |
maxMotorTorque | The maximum motor torque, typically in newton-meters |
motorSpeed | The desired motor speed in radians per second |
collideConnected | Set this flag to true if the attached bodies should collide |
userData | User data |