Box2D 3.1.0
A 2D physics engine for games
Loading...
Searching...
No Matches
Weld Joint

A weld joint fully constrains the relative transform between two bodies while allowing for springiness More...

Collaboration diagram for Weld Joint:

Data Structures

struct  b2WeldJointDef
 Weld joint definition. More...
 

Functions

b2JointId b2CreateWeldJoint (b2WorldId worldId, const b2WeldJointDef *def)
 Create a weld joint.
 
void b2WeldJoint_SetLinearHertz (b2JointId jointId, float hertz)
 Set the weld joint linear stiffness in Hertz. 0 is rigid.
 
float b2WeldJoint_GetLinearHertz (b2JointId jointId)
 Get the weld joint linear stiffness in Hertz.
 
void b2WeldJoint_SetLinearDampingRatio (b2JointId jointId, float dampingRatio)
 Set the weld joint linear damping ratio (non-dimensional)
 
float b2WeldJoint_GetLinearDampingRatio (b2JointId jointId)
 Get the weld joint linear damping ratio (non-dimensional)
 
void b2WeldJoint_SetAngularHertz (b2JointId jointId, float hertz)
 Set the weld joint angular stiffness in Hertz. 0 is rigid.
 
float b2WeldJoint_GetAngularHertz (b2JointId jointId)
 Get the weld joint angular stiffness in Hertz.
 
void b2WeldJoint_SetAngularDampingRatio (b2JointId jointId, float dampingRatio)
 Set weld joint angular damping ratio, non-dimensional.
 
float b2WeldJoint_GetAngularDampingRatio (b2JointId jointId)
 Get the weld joint angular damping ratio, non-dimensional.
 
b2WeldJointDef b2DefaultWeldJointDef (void)
 Use this to initialize your joint definition.
 

Detailed Description

A weld joint fully constrains the relative transform between two bodies while allowing for springiness

A weld joint constrains the relative rotation and translation between two bodies. Both rotation and translation can have damped springs.

Note
The accuracy of weld joint is limited by the accuracy of the solver. Long chains of weld joints may flex.

Data Structure Documentation

◆ b2WeldJointDef

struct b2WeldJointDef

Weld joint definition.

A weld joint connect to bodies together rigidly. This constraint provides springs to mimic soft-body simulation.

Note
The approximate solver in Box2D cannot hold many bodies together rigidly
Collaboration diagram for b2WeldJointDef:
Data Fields
float angularDampingRatio Linear damping ratio, non-dimensional. Use 1 for critical damping.
float angularHertz Angular stiffness as Hertz (cycles per second). Use zero for maximum stiffness.
b2BodyId bodyIdA The first attached body.
b2BodyId bodyIdB The second attached body.
bool collideConnected Set this flag to true if the attached bodies should collide.
int32_t internalValue Used internally to detect a valid definition. DO NOT SET.
float linearDampingRatio Linear damping ratio, non-dimensional. Use 1 for critical damping.
float linearHertz Linear stiffness expressed as Hertz (cycles per second). Use zero for maximum stiffness.
b2Vec2 localAnchorA The local anchor point relative to bodyA's origin.
b2Vec2 localAnchorB The local anchor point relative to bodyB's origin.
float referenceAngle The bodyB angle minus bodyA angle in the reference state (radians)
void * userData User data pointer.

Function Documentation

◆ b2CreateWeldJoint()

b2JointId b2CreateWeldJoint ( b2WorldId worldId,
const b2WeldJointDef * def )

Create a weld joint.

See also
b2WeldJointDef for details