Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | List of all members
box2d::RevoluteJointDef Struct Reference

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: More...

#include <RevoluteJoint.hpp>

Inheritance diagram for box2d::RevoluteJointDef:
box2d::JointDef

Public Member Functions

constexpr RevoluteJointDef () noexcept
 
 RevoluteJointDef (Body *bodyA, Body *bodyB, const Length2D anchor, bool cc=false)
 Initialize the bodies, anchors, and reference angle using a world anchor point. More...
 
- Public Member Functions inherited from box2d::JointDef
 JointDef ()=delete
 Deleted default constructor for abstract base class. More...
 
constexpr JointDef (JointType t) noexcept
 
constexpr JointDef (JointType t, Body *bA, Body *bB, bool cc=false, void *u=nullptr) noexcept
 

Public Attributes

Length2D localAnchorA = Vec2_zero * Meter
 The local anchor point relative to bodyA's origin. More...
 
Length2D localAnchorB = Vec2_zero * Meter
 The local anchor point relative to bodyB's origin. More...
 
Angle referenceAngle = Angle{0}
 The bodyB angle minus bodyA angle in the reference state (radians). More...
 
bool enableLimit = false
 A flag to enable joint limits. More...
 
Angle lowerAngle = Angle{0}
 The lower angle for the joint limit (radians). More...
 
Angle upperAngle = Angle{0}
 The upper angle for the joint limit (radians). More...
 
bool enableMotor = false
 A flag to enable the joint motor. More...
 
AngularVelocity motorSpeed = AngularVelocity{0}
 The desired motor speed. More...
 
Torque maxMotorTorque = 0
 The maximum motor torque used to achieve the desired motor speed. Usually in N-m. More...
 
- Public Attributes inherited from box2d::JointDef
const JointType type
 The joint type is set automatically for concrete joint types. More...
 
BodybodyA = nullptr
 The first attached body. More...
 
BodybodyB = nullptr
 The second attached body. More...
 
bool collideConnected = false
 Set this flag to true if the attached bodies should collide. More...
 
void * userData = nullptr
 Use this to attach application specific data to your joints. More...
 

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() [1/2]

constexpr box2d::RevoluteJointDef::RevoluteJointDef ( )
inlinenoexcept

◆ RevoluteJointDef() [2/2]

RevoluteJointDef::RevoluteJointDef ( Body bodyA,
Body bodyB,
const Length2D  anchor,
bool  cc = false 
)

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

Member Data Documentation

◆ enableLimit

bool box2d::RevoluteJointDef::enableLimit = false

A flag to enable joint limits.

◆ enableMotor

bool box2d::RevoluteJointDef::enableMotor = false

A flag to enable the joint motor.

◆ localAnchorA

Length2D box2d::RevoluteJointDef::localAnchorA = Vec2_zero * Meter

The local anchor point relative to bodyA's origin.

◆ localAnchorB

Length2D box2d::RevoluteJointDef::localAnchorB = Vec2_zero * Meter

The local anchor point relative to bodyB's origin.

◆ lowerAngle

Angle box2d::RevoluteJointDef::lowerAngle = Angle{0}

The lower angle for the joint limit (radians).

◆ maxMotorTorque

Torque box2d::RevoluteJointDef::maxMotorTorque = 0

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

◆ motorSpeed

AngularVelocity box2d::RevoluteJointDef::motorSpeed = AngularVelocity{0}

The desired motor speed.

◆ referenceAngle

Angle box2d::RevoluteJointDef::referenceAngle = Angle{0}

The bodyB angle minus bodyA angle in the reference state (radians).

◆ upperAngle

Angle box2d::RevoluteJointDef::upperAngle = Angle{0}

The upper angle for the joint limit (radians).


The documentation for this struct was generated from the following files: