HughPH.Box2D
Organised dotnet bindings for Box2D 3.1.0
Loading...
Searching...
No Matches
Public Member Functions | Properties | List of all members
Box2D.RevoluteJointDef Class Referencesealed

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.
 

Detailed Description

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

Constructor & Destructor Documentation

◆ RevoluteJointDef()

Box2D.RevoluteJointDef.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 
)
inline

Construct a revolute joint definition with the supplied values.

Parameters
bodyAThe first attached body
bodyBThe second attached body
anchorAThe local anchor point relative to bodyA's origin
anchorBThe local anchor point relative to bodyB's origin
referenceAngleThe bodyB angle minus bodyA angle in the reference state (radians)
enableSpringEnable a rotational spring on the revolute hinge axis
hertzThe spring stiffness Hertz, cycles per second
dampingRatioThe spring damping ratio, non-dimensional
enableLimitA flag to enable joint limits
lowerAngleThe lower angle for the joint limit in radians
upperAngleThe upper angle for the joint limit in radians
enableMotorA flag to enable the joint motor
maxMotorTorqueThe maximum motor torque, typically in newton-meters
motorSpeedThe desired motor speed in radians per second
collideConnectedSet this flag to true if the attached bodies should collide
userDataUser data

The documentation for this class was generated from the following file: