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
b2DistanceJointDef Struct Reference

`#include <b2DistanceJoint.h>`

Inheritance diagram for b2DistanceJointDef:

## Public Member Functions
| b2DistanceJointDef ()
void | Initialize (b2Body *bodyA, b2Body *bodyB, const b2Vec2 &anchorA, const b2Vec2 &anchorB)
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 | length
| The natural length between the anchor points. More...
float32 | frequencyHz
float32 | dampingRatio
| The damping ratio. 0 = no damping, 1 = critical damping. More...
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

Distance joint definition. This requires defining an anchor point on both bodies and the non-zero length of the distance joint. The definition uses local anchor points so that the initial configuration can violate the constraint slightly. This helps when saving and loading a game.

Warning
  Do not use a zero or short length.

## Constructor & Destructor Documentation

b2DistanceJointDef | ( |  | ) |
| inline

## Member Function Documentation

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

Initialize the bodies, anchors, and length using the world anchors.

## Member Data Documentation

float32 dampingRatio

The damping ratio. 0 = no damping, 1 = critical damping.

float32 frequencyHz

The mass-spring-damper frequency in Hertz. A value of 0 disables softness.

float32 length

The natural length between the anchor points.

b2Vec2 localAnchorA

The local anchor point relative to bodyA's origin.

b2Vec2 localAnchorB

The local anchor point relative to bodyB's origin.

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

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