Torque2D Reference

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | List of all members
b2RevoluteJointDef Struct Reference

`#include <b2RevoluteJoint.h>`

Inheritance diagram for b2RevoluteJointDef:

## Public Member Functions
| b2RevoluteJointDef ()
void | Initialize (b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchor)
Public Member Functions inherited from b2JointDef
| b2JointDef ()

## Public Attributes
b2Vec2 | localAnchorA
| The local anchor point relative to bodyA's origin. More...
b2Vec2 | localAnchorB
| The local anchor point relative to bodyB's origin. More...
float32 | referenceAngle
| The bodyB angle minus bodyA angle in the reference state (radians). More...
bool | enableLimit
| A flag to enable joint limits. More...
float32 | lowerAngle
| The lower angle for the joint limit (radians). More...
float32 | upperAngle
| The upper angle for the joint limit (radians). More...
bool | enableMotor
| A flag to enable the joint motor. More...
float32 | motorSpeed
| The desired motor speed. Usually in radians per second. More...
float32 | maxMotorTorque
Public Attributes inherited from b2JointDef
b2JointType | type
| The joint type is set automatically for concrete joint types. More...
void * | userData
| Use this to attach application specific data to your joints. More...
b2Body * | bodyA
| The first attached body. More...
b2Body * | bodyB
| The second attached body. More...
bool | collideConnected
| Set this flag to true if the attached bodies should collide. 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

b2RevoluteJointDef | ( |  | ) |
| inline

## Member Function Documentation

void Initialize | ( | b2Body * | bodyA,
|  | b2Body * | bodyB,
|  | const b2Vec2 & | anchor
| ) |  |

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

## Member Data Documentation

bool enableLimit

A flag to enable joint limits.

bool enableMotor

A flag to enable the joint motor.

b2Vec2 localAnchorA

The local anchor point relative to bodyA's origin.

b2Vec2 localAnchorB

The local anchor point relative to bodyB's origin.

float32 lowerAngle

The lower angle for the joint limit (radians).

float32 maxMotorTorque

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

float32 motorSpeed

The desired motor speed. Usually in radians per second.

float32 referenceAngle

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

float32 upperAngle

The upper angle for the joint limit (radians).

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

- Box2D/Dynamics/Joints/b2RevoluteJoint.h
- Box2D/Dynamics/Joints/b2RevoluteJoint.cpp