Box2D 3.1.0
A 2D physics engine for games
|
The wheel joint can be used to simulate wheels on vehicles. More...
Data Structures | |
struct | b2WheelJointDef |
Wheel joint definition. 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_SetMotorSpeed (b2JointId jointId, float motorSpeed) |
Set the wheel joint motor speed in radians per second. | |
float | b2WheelJoint_GetMotorSpeed (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, typically in newton-meters. | |
float | b2WheelJoint_GetMaxMotorTorque (b2JointId jointId) |
Get the wheel joint maximum motor torque, typically in newton-meters. | |
float | b2WheelJoint_GetMotorTorque (b2JointId jointId) |
Get the wheel joint current motor torque, typically in newton-meters. | |
b2WheelJointDef | b2DefaultWheelJointDef (void) |
Use this to initialize your joint definition. | |
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.
struct b2WheelJointDef |
Wheel joint definition.
This requires defining a line of motion using an axis and an anchor point. The definition uses local anchor points and a local axis so that the initial configuration can violate the constraint slightly. The joint translation is zero when the local anchor points coincide in world space.
Data Fields | ||
---|---|---|
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. |
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. |
int32_t | internalValue | Used internally to detect a valid definition. DO NOT SET. |
b2Vec2 | localAnchorA | The local anchor point relative to bodyA's origin. |
b2Vec2 | localAnchorB | The local anchor point relative to bodyB's origin. |
b2Vec2 | localAxisA | The local translation unit axis in bodyA. |
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. |
void * | userData | User data pointer. |
b2JointId b2CreateWheelJoint | ( | b2WorldId | worldId, |
const b2WheelJointDef * | def ) |
Create a wheel joint.