Box2D: b2RevoluteJointDef Struct Reference

# b2RevoluteJointDef Struct Reference

`#include <b2RevoluteJoint.h>`

Inheritance diagram for b2RevoluteJointDef:

List of all members.

## Public Member Functions

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

## Public Attributes

b2Vec2 | localAnchorA
| The local anchor point relative to body1's origin.
b2Vec2 | localAnchorB
| The local anchor point relative to body2's origin.
float32 | referenceAngle
| The body2 angle minus body1 angle in the reference state (radians).
bool | enableLimit
| A flag to enable joint limits.
float32 | lowerAngle
| The lower angle for the joint limit (radians).
float32 | upperAngle
| The upper angle for the joint limit (radians).
bool | enableMotor
| A flag to enable the joint motor.
float32 | motorSpeed
| The desired motor speed. Usually in radians per second.
float32 | maxMotorTorque

## 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::b2RevoluteJointDef | ( |  | ) | `[inline]`

## Member Function Documentation

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

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

## Member Data Documentation

bool b2RevoluteJointDef::enableLimit

A flag to enable joint limits.

bool b2RevoluteJointDef::enableMotor

A flag to enable the joint motor.

b2Vec2 b2RevoluteJointDef::localAnchorA

The local anchor point relative to body1's origin.

b2Vec2 b2RevoluteJointDef::localAnchorB

The local anchor point relative to body2's origin.

float32 b2RevoluteJointDef::lowerAngle

The lower angle for the joint limit (radians).

float32 b2RevoluteJointDef::maxMotorTorque

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

float32 b2RevoluteJointDef::motorSpeed

The desired motor speed. Usually in radians per second.

float32 b2RevoluteJointDef::referenceAngle

The body2 angle minus body1 angle in the reference state (radians).

float32 b2RevoluteJointDef::upperAngle

The upper angle for the joint limit (radians).

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

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