Box2D  2.4.0
A 2D physics engine for games
b2DistanceJointDef Struct Reference

#include <b2_distance_joint.h>

Inheritance diagram for b2DistanceJointDef:
b2JointDef

Public Member Functions

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

Public Attributes

b2Vec2 localAnchorA
 The local anchor point relative to bodyA's origin.
 
b2Vec2 localAnchorB
 The local anchor point relative to bodyB's origin.
 
float length
 The natural length between the anchor points.
 
float stiffness
 The linear stiffness in N/m. A value of 0 disables softness.
 
float damping
 The linear damping in N*s/m.
 
- Public Attributes inherited from b2JointDef
b2JointType type
 The joint type is set automatically for concrete joint types.
 
void * userData
 Use this to attach application specific data to your joints.
 
b2BodybodyA
 The first attached body.
 
b2BodybodyB
 The second attached body.
 
bool collideConnected
 Set this flag to true if the attached bodies should collide.
 

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.

Member Function Documentation

◆ Initialize()

void b2DistanceJointDef::Initialize ( b2Body bodyA,
b2Body bodyB,
const b2Vec2 anchorA,
const b2Vec2 anchorB 
)

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


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