Box2D  3.0.0
A Real-Time-Oriented 2-D Physics Engine
Public Member Functions | Public Attributes | List of all members
box2d::DistanceJointDef Struct Reference

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. More...

#include <DistanceJoint.hpp>

Inheritance diagram for box2d::DistanceJointDef:
box2d::JointDef

Public Member Functions

constexpr DistanceJointDef () noexcept
 
 DistanceJointDef (const DistanceJointDef &copy)=default
 
 DistanceJointDef (Body *bodyA, Body *bodyB, const Length2D anchorA=Vec2_zero *Meter, const Length2D anchorB=Vec2_zero *Meter, Frequency freq=Frequency{0}, RealNum damp=0) noexcept
 Initialize the bodies, anchors, and length using the world anchors. More...
 
- Public Member Functions inherited from box2d::JointDef
 JointDef ()=delete
 Deleted default constructor for abstract base class. More...
 
constexpr JointDef (JointType t) noexcept
 
constexpr JointDef (JointType t, Body *bA, Body *bB, bool cc=false, void *u=nullptr) noexcept
 

Public Attributes

Length2D localAnchorA = Vec2_zero * Meter
 The local anchor point relative to bodyA's origin. More...
 
Length2D localAnchorB = Vec2_zero * Meter
 The local anchor point relative to bodyB's origin. More...
 
Length length = RealNum{1} * Meter
 The natural length between the anchor points. More...
 
Frequency frequencyHz = Frequency{0}
 Mass-spring-damper frequency in Hertz. More...
 
RealNum dampingRatio = 0
 The damping ratio. 0 = no damping, 1 = critical damping. More...
 
- Public Attributes inherited from box2d::JointDef
const JointType type
 The joint type is set automatically for concrete joint types. More...
 
BodybodyA = nullptr
 The first attached body. More...
 
BodybodyB = nullptr
 The second attached body. More...
 
bool collideConnected = false
 Set this flag to true if the attached bodies should collide. More...
 
void * userData = nullptr
 Use this to attach application specific data to your joints. 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

◆ DistanceJointDef() [1/3]

constexpr box2d::DistanceJointDef::DistanceJointDef ( )
inlinenoexcept

◆ DistanceJointDef() [2/3]

box2d::DistanceJointDef::DistanceJointDef ( const DistanceJointDef copy)
default

◆ DistanceJointDef() [3/3]

DistanceJointDef::DistanceJointDef ( Body bodyA,
Body bodyB,
const Length2D  anchorA = Vec2_zero * Meter,
const Length2D  anchorB = Vec2_zero * Meter,
Frequency  freq = Frequency{0},
RealNum  damp = 0 
)
noexcept

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

Member Data Documentation

◆ dampingRatio

RealNum box2d::DistanceJointDef::dampingRatio = 0

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

◆ frequencyHz

Frequency box2d::DistanceJointDef::frequencyHz = Frequency{0}

Mass-spring-damper frequency in Hertz.

Note
0 disables softness.
Should be 0 or greater.

◆ length

Length box2d::DistanceJointDef::length = RealNum{1} * Meter

The natural length between the anchor points.

◆ localAnchorA

Length2D box2d::DistanceJointDef::localAnchorA = Vec2_zero * Meter

The local anchor point relative to bodyA's origin.

◆ localAnchorB

Length2D box2d::DistanceJointDef::localAnchorB = Vec2_zero * Meter

The local anchor point relative to bodyB's origin.


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