Box2D  2.4.1
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 rest length of this joint. Clamped to a stable minimum value.
 
float minLength
 Minimum length. Clamped to a stable minimum value.
 
float maxLength
 Maximum length. Must be greater than or equal to the minimum length.
 
float stiffness
 The linear stiffness in N/m.
 
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.
 
b2JointUserData 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 distance 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.

Member Function Documentation

◆ Initialize()

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

Initialize the bodies, anchors, and rest length using world space anchors. The minimum and maximum lengths are set to the rest length.


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