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

A prismatic joint allows for translation along a single axis with no rotation. More...

Collaboration diagram for Prismatic Joint:

Data Structures

struct  b3PrismaticJointDef
 Prismatic joint definition. More...

Functions

b3JointId b3CreatePrismaticJoint (b3WorldId worldId, const b3PrismaticJointDef *def)
 Create a prismatic (slider) joint.
void b3PrismaticJoint_EnableSpring (b3JointId jointId, bool enableSpring)
 Enable/disable the joint spring.
bool b3PrismaticJoint_IsSpringEnabled (b3JointId jointId)
 Is the prismatic joint spring enabled or not?
void b3PrismaticJoint_SetSpringHertz (b3JointId jointId, float hertz)
 Set the prismatic joint stiffness in Hertz.
float b3PrismaticJoint_GetSpringHertz (b3JointId jointId)
 Get the prismatic joint stiffness in Hertz.
void b3PrismaticJoint_SetSpringDampingRatio (b3JointId jointId, float dampingRatio)
 Set the prismatic joint damping ratio (non-dimensional).
float b3PrismaticJoint_GetSpringDampingRatio (b3JointId jointId)
 Get the prismatic spring damping ratio (non-dimensional).
void b3PrismaticJoint_SetTargetTranslation (b3JointId jointId, float targetTranslation)
 Set the prismatic joint target translation. Usually in meters.
float b3PrismaticJoint_GetTargetTranslation (b3JointId jointId)
 Get the prismatic joint target translation. Usually in meters.
void b3PrismaticJoint_EnableLimit (b3JointId jointId, bool enableLimit)
 Enable/disable a prismatic joint limit.
bool b3PrismaticJoint_IsLimitEnabled (b3JointId jointId)
 Is the prismatic joint limit enabled?
float b3PrismaticJoint_GetLowerLimit (b3JointId jointId)
 Get the prismatic joint lower limit.
float b3PrismaticJoint_GetUpperLimit (b3JointId jointId)
 Get the prismatic joint upper limit.
void b3PrismaticJoint_SetLimits (b3JointId jointId, float lower, float upper)
 Set the prismatic joint limits.
void b3PrismaticJoint_EnableMotor (b3JointId jointId, bool enableMotor)
 Enable/disable a prismatic joint motor.
bool b3PrismaticJoint_IsMotorEnabled (b3JointId jointId)
 Is the prismatic joint motor enabled?
void b3PrismaticJoint_SetMotorSpeed (b3JointId jointId, float motorSpeed)
 Set the prismatic joint motor speed, usually in meters per second.
float b3PrismaticJoint_GetMotorSpeed (b3JointId jointId)
 Get the prismatic joint motor speed, usually in meters per second.
void b3PrismaticJoint_SetMaxMotorForce (b3JointId jointId, float force)
 Set the prismatic joint maximum motor force, usually in newtons.
float b3PrismaticJoint_GetMaxMotorForce (b3JointId jointId)
 Get the prismatic joint maximum motor force, usually in newtons.
float b3PrismaticJoint_GetMotorForce (b3JointId jointId)
 Get the prismatic joint current motor force, usually in newtons.
float b3PrismaticJoint_GetTranslation (b3JointId jointId)
 Get the current joint translation, usually in meters.
float b3PrismaticJoint_GetSpeed (b3JointId jointId)
 Get the current joint translation speed, usually in meters per second.
b3PrismaticJointDef b3DefaultPrismaticJointDef (void)
 Use this to initialize your joint definition.

Detailed Description

A prismatic joint allows for translation along a single axis with no rotation.

The prismatic joint is useful for things like pistons and moving platforms, where you want a body to translate along an axis and have no rotation. Also called a slider joint.


Data Structure Documentation

◆ b3PrismaticJointDef

struct b3PrismaticJointDef

Prismatic joint definition.

Body B may slide along the x-axis in local frame A. Body B cannot rotate relative to body A. The joint translation is zero when the local frame origins coincide in world space.

Collaboration diagram for b3PrismaticJointDef:
Data Fields
b3JointDef base Base joint definition.
float dampingRatio The spring damping ratio, non-dimensional.
bool enableLimit Enable/disable the joint limit.
bool enableMotor Enable/disable the joint motor.
bool enableSpring Enable a linear spring along the prismatic joint axis.
float hertz The spring stiffness Hertz, cycles per second.
float lowerTranslation The lower translation limit.
float maxMotorForce The maximum motor force, typically in newtons.
float motorSpeed The desired motor speed, typically in meters per second.
float targetTranslation The target translation for the joint in meters.

The spring-damper will drive to this translation.

float upperTranslation The upper translation limit.

Function Documentation

◆ b3CreatePrismaticJoint()

b3JointId b3CreatePrismaticJoint ( b3WorldId worldId,
const b3PrismaticJointDef * def )

Create a prismatic (slider) joint.

See also
b3PrismaticJointDef for details

◆ b3PrismaticJoint_SetSpringHertz()

void b3PrismaticJoint_SetSpringHertz ( b3JointId jointId,
float hertz )

Set the prismatic joint stiffness in Hertz.

This should usually be less than a quarter of the simulation rate. For example, if the simulation runs at 60Hz then the joint stiffness should be 15Hz or less.