Jolt Physics
A multi core friendly Game Physics Engine
|
Base class for runtime data for a wheel, each VehicleController can implement a derived class of this. More...
#include <Wheel.h>
Public Member Functions | |
JPH_OVERRIDE_NEW_DELETE | Wheel (const WheelSettings &inSettings) |
Constructor / destructor. | |
virtual | ~Wheel ()=default |
const WheelSettings * | GetSettings () const |
Get settings for the wheel. | |
float | GetAngularVelocity () const |
Get the angular velocity (rad/s) for this wheel, note that positive means the wheel is rotating such that the car moves forward. | |
void | SetAngularVelocity (float inVel) |
Update the angular velocity (rad/s) | |
float | GetRotationAngle () const |
Get the current rotation angle of the wheel in radians [0, 2 pi]. | |
void | SetRotationAngle (float inAngle) |
Set the current rotation angle of the wheel in radians [0, 2 pi]. | |
float | GetSteerAngle () const |
Get the current steer angle of the wheel in radians [-pi, pi], positive is to the left. | |
void | SetSteerAngle (float inAngle) |
Set the current steer angle of the wheel in radians [-pi, pi]. | |
bool | HasContact () const |
Returns true if the wheel is touching an object. | |
BodyID | GetContactBodyID () const |
Returns the body ID of the body that this wheel is touching. | |
SubShapeID | GetContactSubShapeID () const |
Returns the sub shape ID where we're contacting the body. | |
RVec3 | GetContactPosition () const |
Returns the current contact position in world space (note by the time you call this the vehicle has moved) | |
Vec3 | GetContactPointVelocity () const |
Velocity of the contact point (m / s, not relative to the wheel but in world space) | |
Vec3 | GetContactNormal () const |
Returns the current contact normal in world space (note by the time you call this the vehicle has moved) | |
Vec3 | GetContactLongitudinal () const |
Returns longitudinal direction (direction along the wheel relative to floor) in world space (note by the time you call this the vehicle has moved) | |
Vec3 | GetContactLateral () const |
Returns lateral direction (sideways direction) in world space (note by the time you call this the vehicle has moved) | |
float | GetSuspensionLength () const |
Get the length of the suspension for a wheel (m) relative to the suspension attachment point (hard point) | |
bool | HasHitHardPoint () const |
Check if the suspension hit its upper limit. | |
float | GetSuspensionLambda () const |
Get the total impulse (N s) that was applied by the suspension. | |
float | GetLongitudinalLambda () const |
Get total impulse (N s) applied along the forward direction of the wheel. | |
float | GetLateralLambda () const |
Get total impulse (N s) applied along the sideways direction of the wheel. | |
bool | SolveLongitudinalConstraintPart (const VehicleConstraint &inConstraint, float inMinImpulse, float inMaxImpulse) |
Internal function that should only be called by the controller. Used to apply impulses in the forward direction of the vehicle. | |
bool | SolveLateralConstraintPart (const VehicleConstraint &inConstraint, float inMinImpulse, float inMaxImpulse) |
Internal function that should only be called by the controller. Used to apply impulses in the sideways direction of the vehicle. | |
Public Member Functions inherited from NonCopyable | |
NonCopyable ()=default | |
NonCopyable (const NonCopyable &)=delete | |
void | operator= (const NonCopyable &)=delete |
Protected Attributes | |
RefConst< WheelSettings > | mSettings |
Configuration settings for this wheel. | |
BodyID | mContactBodyID |
ID of body for ground. | |
SubShapeID | mContactSubShapeID |
Sub shape ID for ground. | |
Body * | mContactBody = nullptr |
Body for ground. | |
float | mSuspensionLength |
Current length of the suspension. | |
RVec3 | mContactPosition |
Position of the contact point between wheel and ground. | |
Vec3 | mContactPointVelocity |
Velocity of the contact point (m / s, not relative to the wheel but in world space) | |
Vec3 | mContactNormal |
Normal of the contact point between wheel and ground. | |
Vec3 | mContactLongitudinal |
Vector perpendicular to normal in the forward direction. | |
Vec3 | mContactLateral |
Vector perpendicular to normal and longitudinal direction in the right direction. | |
Real | mAxlePlaneConstant |
Constant for the contact plane of the axle, defined as ContactNormal . (WorldSpaceSuspensionPoint + SuspensionLength * WorldSpaceSuspensionDirection) | |
float | mAntiRollBarImpulse = 0.0f |
Amount of impulse applied to the suspension from the anti-rollbars. | |
float | mSteerAngle = 0.0f |
Rotation around the suspension direction, positive is to the left. | |
float | mAngularVelocity = 0.0f |
Rotation speed of wheel, positive when the wheels cause the vehicle to move forwards (rad/s) | |
float | mAngle = 0.0f |
Current rotation of the wheel (rad, [0, 2 pi]) | |
AxisConstraintPart | mSuspensionPart |
Controls movement up/down along the contact normal. | |
AxisConstraintPart | mSuspensionMaxUpPart |
Adds a hard limit when reaching the minimal suspension length. | |
AxisConstraintPart | mLongitudinalPart |
Controls movement forward/backward. | |
AxisConstraintPart | mLateralPart |
Controls movement sideways (slip) | |
Friends | |
class | VehicleConstraint |
Base class for runtime data for a wheel, each VehicleController can implement a derived class of this.
|
explicit |
Constructor / destructor.
|
virtualdefault |
|
inline |
Get the angular velocity (rad/s) for this wheel, note that positive means the wheel is rotating such that the car moves forward.
|
inline |
Returns the body ID of the body that this wheel is touching.
|
inline |
Returns lateral direction (sideways direction) in world space (note by the time you call this the vehicle has moved)
|
inline |
Returns longitudinal direction (direction along the wheel relative to floor) in world space (note by the time you call this the vehicle has moved)
|
inline |
Returns the current contact normal in world space (note by the time you call this the vehicle has moved)
|
inline |
Velocity of the contact point (m / s, not relative to the wheel but in world space)
|
inline |
Returns the current contact position in world space (note by the time you call this the vehicle has moved)
|
inline |
Returns the sub shape ID where we're contacting the body.
|
inline |
Get total impulse (N s) applied along the sideways direction of the wheel.
|
inline |
Get total impulse (N s) applied along the forward direction of the wheel.
|
inline |
Get the current rotation angle of the wheel in radians [0, 2 pi].
|
inline |
Get settings for the wheel.
|
inline |
Get the current steer angle of the wheel in radians [-pi, pi], positive is to the left.
|
inline |
Get the total impulse (N s) that was applied by the suspension.
|
inline |
Get the length of the suspension for a wheel (m) relative to the suspension attachment point (hard point)
|
inline |
Returns true if the wheel is touching an object.
|
inline |
Check if the suspension hit its upper limit.
|
inline |
Update the angular velocity (rad/s)
|
inline |
Set the current rotation angle of the wheel in radians [0, 2 pi].
|
inline |
Set the current steer angle of the wheel in radians [-pi, pi].
bool Wheel::SolveLateralConstraintPart | ( | const VehicleConstraint & | inConstraint, |
float | inMinImpulse, | ||
float | inMaxImpulse | ||
) |
Internal function that should only be called by the controller. Used to apply impulses in the sideways direction of the vehicle.
bool Wheel::SolveLongitudinalConstraintPart | ( | const VehicleConstraint & | inConstraint, |
float | inMinImpulse, | ||
float | inMaxImpulse | ||
) |
Internal function that should only be called by the controller. Used to apply impulses in the forward direction of the vehicle.
|
friend |
|
protected |
Current rotation of the wheel (rad, [0, 2 pi])
|
protected |
Rotation speed of wheel, positive when the wheels cause the vehicle to move forwards (rad/s)
|
protected |
Amount of impulse applied to the suspension from the anti-rollbars.
|
protected |
Constant for the contact plane of the axle, defined as ContactNormal . (WorldSpaceSuspensionPoint + SuspensionLength * WorldSpaceSuspensionDirection)
|
protected |
ID of body for ground.
|
protected |
Vector perpendicular to normal and longitudinal direction in the right direction.
|
protected |
Normal of the contact point between wheel and ground.
|
protected |
Velocity of the contact point (m / s, not relative to the wheel but in world space)
|
protected |
Position of the contact point between wheel and ground.
|
protected |
Sub shape ID for ground.
|
protected |
Controls movement sideways (slip)
|
protected |
Controls movement forward/backward.
|
protected |
Configuration settings for this wheel.
|
protected |
Rotation around the suspension direction, positive is to the left.
|
protected |
Current length of the suspension.
|
protected |
Adds a hard limit when reaching the minimal suspension length.
|
protected |
Controls movement up/down along the contact normal.