Box2D 3.2.0
A 2D physics engine for games
Loading...
Searching...
No Matches

The wheel joint can be used to simulate wheels on vehicles. More...

Data Structures

struct  b2WheelJointDef
 Wheel joint definition Body B is a wheel that may rotate freely and slide along the local x-axis in frame A. More...

Functions

b2JointId b2CreateWheelJoint (b2WorldId worldId, const b2WheelJointDef *def)
 Create a wheel joint.
void b2WheelJoint_EnableSpring (b2JointId jointId, bool enableSpring)
 Enable/disable the wheel joint spring.
bool b2WheelJoint_IsSpringEnabled (b2JointId jointId)
 Is the wheel joint spring enabled?
void b2WheelJoint_SetSpringHertz (b2JointId jointId, float hertz)
 Set the wheel joint stiffness in Hertz.
float b2WheelJoint_GetSpringHertz (b2JointId jointId)
 Get the wheel joint stiffness in Hertz.
void b2WheelJoint_SetSpringDampingRatio (b2JointId jointId, float dampingRatio)
 Set the wheel joint damping ratio, non-dimensional.
float b2WheelJoint_GetSpringDampingRatio (b2JointId jointId)
 Get the wheel joint damping ratio, non-dimensional.
void b2WheelJoint_EnableLimit (b2JointId jointId, bool enableLimit)
 Enable/disable the wheel joint limit.
bool b2WheelJoint_IsLimitEnabled (b2JointId jointId)
 Is the wheel joint limit enabled?
float b2WheelJoint_GetLowerLimit (b2JointId jointId)
 Get the wheel joint lower limit.
float b2WheelJoint_GetUpperLimit (b2JointId jointId)
 Get the wheel joint upper limit.
void b2WheelJoint_SetLimits (b2JointId jointId, float lower, float upper)
 Set the wheel joint limits.
void b2WheelJoint_EnableMotor (b2JointId jointId, bool enableMotor)
 Enable/disable the wheel joint motor.
bool b2WheelJoint_IsMotorEnabled (b2JointId jointId)
 Is the wheel joint motor enabled?
void b2WheelJoint_SetTargetMotorSpeed (b2JointId jointId, float motorSpeed)
 Set the wheel joint motor speed in radians per second.
float b2WheelJoint_GetTargetMotorSpeed (b2JointId jointId)
 Get the wheel joint motor speed in radians per second.
void b2WheelJoint_SetMaxMotorTorque (b2JointId jointId, float torque)
 Set the wheel joint maximum motor torque, usually in newton-meters.
float b2WheelJoint_GetMaxMotorTorque (b2JointId jointId)
 Get the wheel joint maximum motor torque, usually in newton-meters.
float b2WheelJoint_GetCurrentMotorTorque (b2JointId jointId)
 Get the wheel joint current motor torque, usually in newton-meters.
b2WheelJointDef b2DefaultWheelJointDef (void)
 Use this to initialize your joint definition.

Detailed Description

The wheel joint can be used to simulate wheels on vehicles.

The wheel joint restricts body B to move along a local axis in body A. Body B is free to rotate. Supports a linear spring, linear limits, and a rotational motor.


Data Structure Documentation

◆ b2WheelJointDef

struct b2WheelJointDef

Wheel joint definition Body B is a wheel that may rotate freely and slide along the local x-axis in frame A.

The joint translation is zero when the local frame origins coincide in world space.

Data Fields
b2JointDef base Base joint definition.
float dampingRatio Spring damping ratio, non-dimensional.
bool enableLimit Enable/disable the joint linear limit.
bool enableMotor Enable/disable the joint rotational motor.
bool enableSpring Enable a linear spring along the local axis.
float hertz Spring stiffness in Hertz.
int internalValue Used internally to detect a valid definition. DO NOT SET.
float lowerTranslation The lower translation limit.
float maxMotorTorque The maximum motor torque, typically in newton-meters.
float motorSpeed The desired motor speed in radians per second.
float upperTranslation The upper translation limit.

Function Documentation

◆ b2CreateWheelJoint()

b2JointId b2CreateWheelJoint ( b2WorldId worldId,
const b2WheelJointDef * def )

Create a wheel joint.

See also
b2WheelJointDef for details