Box3D 0.1.0
A 3D physics engine for games
Loading...
Searching...
No Matches

Joints allow you to connect rigid bodies together while allowing various forms of relative motions. More...

Collaboration diagram for Joint:

Topics

 Parallel Joint
 Functions for the parallel joint.
 Distance Joint
 Functions for the distance joint.
 Motor Joint
 Functions for the motor joint.
 Filter Joint
 Functions for the filter joint.
 Prismatic Joint
 A prismatic joint allows for translation along a single axis with no rotation.
 Revolute Joint
 A revolute joint allows for relative rotation about a single axis with no relative translation.
 Spherical Joint
 A spherical joint allows for relative rotation in the 3D space with no relative translation.
 Weld Joint
 A weld joint fully constrains the relative transform between two bodies while allowing for springiness.
 Wheel Joint
 The wheel joint can be used to simulate wheels on vehicles.

Data Structures

struct  b3JointDef
 Base joint definition used by all joint types. More...

Enumerations

enum  b3JointType {
  b3_parallelJoint , b3_distanceJoint , b3_filterJoint , b3_motorJoint ,
  b3_prismaticJoint , b3_revoluteJoint , b3_sphericalJoint , b3_weldJoint ,
  b3_wheelJoint
}
 Joint type enumeration. More...

Functions

void b3DestroyJoint (b3JointId jointId, bool wakeAttached)
 Destroy a joint.
bool b3Joint_IsValid (b3JointId id)
 Joint identifier validation. Provides validation for up to 64K allocations.
b3JointType b3Joint_GetType (b3JointId jointId)
 Get the joint type.
b3BodyId b3Joint_GetBodyA (b3JointId jointId)
 Get body A id on a joint.
b3BodyId b3Joint_GetBodyB (b3JointId jointId)
 Get body B id on a joint.
b3WorldId b3Joint_GetWorld (b3JointId jointId)
 Get the world that owns this joint.
void b3Joint_SetLocalFrameA (b3JointId jointId, b3Transform localFrame)
 Set the local frame on bodyA.
b3Transform b3Joint_GetLocalFrameA (b3JointId jointId)
 Get the local frame on bodyA.
void b3Joint_SetLocalFrameB (b3JointId jointId, b3Transform localFrame)
 Set the local frame on bodyB.
b3Transform b3Joint_GetLocalFrameB (b3JointId jointId)
 Get the local frame on bodyB.
void b3Joint_SetCollideConnected (b3JointId jointId, bool shouldCollide)
 Toggle collision between connected bodies.
bool b3Joint_GetCollideConnected (b3JointId jointId)
 Is collision allowed between connected bodies?
void b3Joint_SetUserData (b3JointId jointId, void *userData)
 Set the user data on a joint.
void * b3Joint_GetUserData (b3JointId jointId)
 Get the user data on a joint.
void b3Joint_WakeBodies (b3JointId jointId)
 Wake the bodies connect to this joint.
b3Vec3 b3Joint_GetConstraintForce (b3JointId jointId)
 Get the current constraint force for this joint.
b3Vec3 b3Joint_GetConstraintTorque (b3JointId jointId)
 Get the current constraint torque for this joint.
float b3Joint_GetLinearSeparation (b3JointId jointId)
 Get the current linear separation error for this joint. Does not consider admissible movement. Usually in meters.
float b3Joint_GetAngularSeparation (b3JointId jointId)
 Get the current angular separation error for this joint. Does not consider admissible movement. Usually in radians.
void b3Joint_SetConstraintTuning (b3JointId jointId, float hertz, float dampingRatio)
 Set the joint constraint tuning.
void b3Joint_GetConstraintTuning (b3JointId jointId, float *hertz, float *dampingRatio)
 Get the joint constraint tuning. Advanced feature.
void b3Joint_SetForceThreshold (b3JointId jointId, float threshold)
 Set the force threshold for joint events (Newtons).
float b3Joint_GetForceThreshold (b3JointId jointId)
 Get the force threshold for joint events (Newtons).
void b3Joint_SetTorqueThreshold (b3JointId jointId, float threshold)
 Set the torque threshold for joint events (N-m).
float b3Joint_GetTorqueThreshold (b3JointId jointId)
 Get the torque threshold for joint events (N-m).

Detailed Description

Joints allow you to connect rigid bodies together while allowing various forms of relative motions.


Data Structure Documentation

◆ b3JointDef

struct b3JointDef

Base joint definition used by all joint types.

The local frames are measured from the body's origin rather than the center of mass because:

  1. You might not know where the center of mass will be.
  2. If you add/remove shapes from a body and recompute the mass, the joints will be broken.
Collaboration diagram for b3JointDef:
Data Fields
b3BodyId bodyIdA The first attached body.
b3BodyId bodyIdB The second attached body.
bool collideConnected Set this flag to true if the attached bodies should collide.
float constraintDampingRatio Constraint damping ratio (advanced feature).
float constraintHertz Constraint hertz (advanced feature).
float drawScale Debug draw scale.
float forceThreshold Force threshold for joint events.
int internalValue Used internally to detect a valid definition. DO NOT SET.
b3Transform localFrameA The first local joint frame.
b3Transform localFrameB The second local joint frame.
float torqueThreshold Torque threshold for joint events.
void * userData User data pointer.

Enumeration Type Documentation

◆ b3JointType

Joint type enumeration.

This is useful because all joint types use b3JointId and sometimes you want to get the type of a joint.

Function Documentation

◆ b3Joint_SetConstraintTuning()

void b3Joint_SetConstraintTuning ( b3JointId jointId,
float hertz,
float dampingRatio )

Set the joint constraint tuning.

Advanced feature.

Parameters
jointIdthe joint
hertzthe stiffness in Hertz (cycles per second)
dampingRatiothe non-dimensional damping ratio (one for critical damping)