24 virtual void SaveBinaryState(
StreamOut &inStream)
const;
27 virtual void RestoreBinaryState(
StreamIn &inStream);
29 Vec3 mPosition { 0, 0, 0 };
30 Vec3 mSuspensionForcePoint { 0, 0, 0 };
31 Vec3 mSuspensionDirection { 0, -1, 0 };
32 Vec3 mSteeringAxis { 0, 1, 0 };
34 Vec3 mWheelForward { 0, 0, 1 };
35 float mSuspensionMinLength = 0.3f;
36 float mSuspensionMaxLength = 0.5f;
37 float mSuspensionPreloadLength = 0.0f;
38 SpringSettings mSuspensionSpring { ESpringMode::FrequencyAndDamping, 1.5f, 0.5f };
41 bool mEnableSuspensionForcePoint =
false;
76 inline bool HasContact()
const {
return !mContactBodyID.IsInvalid(); }
106 float GetSuspensionLambda()
const {
return mSuspensionPart.GetTotalLambda() + mSuspensionMaxUpPart.GetTotalLambda(); }
115 bool SolveLongitudinalConstraintPart(
const VehicleConstraint &inConstraint,
float inMinImpulse,
float inMaxImpulse);
118 bool SolveLateralConstraintPart(
const VehicleConstraint &inConstraint,
float inMinImpulse,
float inMaxImpulse);
134 float mAntiRollBarImpulse = 0.0f;
136 float mSteerAngle = 0.0f;
137 float mAngularVelocity = 0.0f;
#define JPH_EXPORT
Definition: Core.h:227
#define JPH_NAMESPACE_END
Definition: Core.h:367
#define JPH_NAMESPACE_BEGIN
Definition: Core.h:361
#define JPH_ASSERT(...)
Definition: IssueReporting.h:33
#define JPH_OVERRIDE_NEW_DELETE
Macro to override the new and delete functions.
Definition: Memory.h:29
float Real
Definition: Real.h:27
std::vector< T, STLAllocator< T > > Array
Definition: STLAllocator.h:81
#define JPH_DECLARE_SERIALIZABLE_VIRTUAL(linkage, class_name)
Definition: SerializableObject.h:100
Array< Wheel * > Wheels
Definition: Wheel.h:146
Definition: AxisConstraintPart.h:43
ID of a body. This is a way of reasoning about bodies in a multithreaded simulation while avoiding ra...
Definition: BodyID.h:13
Class that makes another class non-copyable. Usage: Inherit from NonCopyable.
Definition: NonCopyable.h:11
Definition: Reference.h:151
Definition: Reference.h:35
Definition: SerializableObject.h:147
Settings for a linear or angular spring.
Definition: SpringSettings.h:23
Simple binary input stream.
Definition: StreamIn.h:13
Simple binary output stream.
Definition: StreamOut.h:13
A sub shape id contains a path to an element (usually a triangle or other primitive type) of a compou...
Definition: SubShapeID.h:23
Definition: VehicleConstraint.h:66
Base class for runtime data for a wheel, each VehicleController can implement a derived class of this...
Definition: Wheel.h:46
RefConst< WheelSettings > mSettings
Configuration settings for this wheel.
Definition: Wheel.h:123
float GetRotationAngle() const
Get the current rotation angle of the wheel in radians [0, 2 pi].
Definition: Wheel.h:64
float GetSteerAngle() const
Get the current steer angle of the wheel in radians [-pi, pi], positive is to the left.
Definition: Wheel.h:70
Vec3 mContactNormal
Normal of the contact point between wheel and ground.
Definition: Wheel.h:130
Vec3 GetContactLateral() const
Returns lateral direction (sideways direction) in world space (note by the time you call this the veh...
Definition: Wheel.h:97
void SetAngularVelocity(float inVel)
Update the angular velocity (rad/s)
Definition: Wheel.h:61
float GetLateralLambda() const
Get total impulse (N s) applied along the sideways direction of the wheel.
Definition: Wheel.h:112
AxisConstraintPart mLateralPart
Controls movement sideways (slip)
Definition: Wheel.h:143
Vec3 mContactLongitudinal
Vector perpendicular to normal in the forward direction.
Definition: Wheel.h:131
float mSuspensionLength
Current length of the suspension.
Definition: Wheel.h:127
SubShapeID GetContactSubShapeID() const
Returns the sub shape ID where we're contacting the body.
Definition: Wheel.h:82
Vec3 GetContactLongitudinal() const
Returns longitudinal direction (direction along the wheel relative to floor) in world space (note by ...
Definition: Wheel.h:94
BodyID mContactBodyID
ID of body for ground.
Definition: Wheel.h:124
AxisConstraintPart mSuspensionMaxUpPart
Adds a hard limit when reaching the minimal suspension length.
Definition: Wheel.h:141
bool HasHitHardPoint() const
Check if the suspension hit its upper limit.
Definition: Wheel.h:103
Vec3 mContactPointVelocity
Velocity of the contact point (m / s, not relative to the wheel but in world space)
Definition: Wheel.h:129
void SetSteerAngle(float inAngle)
Set the current steer angle of the wheel in radians [-pi, pi].
Definition: Wheel.h:73
Vec3 GetContactPointVelocity() const
Velocity of the contact point (m / s, not relative to the wheel but in world space)
Definition: Wheel.h:88
AxisConstraintPart mSuspensionPart
Controls movement up/down along the contact normal.
Definition: Wheel.h:140
Real mAxlePlaneConstant
Constant for the contact plane of the axle, defined as ContactNormal . (WorldSpaceSuspensionPoint + S...
Definition: Wheel.h:133
void SetRotationAngle(float inAngle)
Set the current rotation angle of the wheel in radians [0, 2 pi].
Definition: Wheel.h:67
AxisConstraintPart mLongitudinalPart
Controls movement forward/backward.
Definition: Wheel.h:142
Vec3 GetContactNormal() const
Returns the current contact normal in world space (note by the time you call this the vehicle has mov...
Definition: Wheel.h:91
const WheelSettings * GetSettings() const
Get settings for the wheel.
Definition: Wheel.h:55
RVec3 mContactPosition
Position of the contact point between wheel and ground.
Definition: Wheel.h:128
float GetLongitudinalLambda() const
Get total impulse (N s) applied along the forward direction of the wheel.
Definition: Wheel.h:109
BodyID GetContactBodyID() const
Returns the body ID of the body that this wheel is touching.
Definition: Wheel.h:79
float GetSuspensionLength() const
Get the length of the suspension for a wheel (m) relative to the suspension attachment point (hard po...
Definition: Wheel.h:100
float GetAngularVelocity() const
Get the angular velocity (rad/s) for this wheel, note that positive means the wheel is rotating such ...
Definition: Wheel.h:58
bool HasContact() const
Returns true if the wheel is touching an object.
Definition: Wheel.h:76
Vec3 mContactLateral
Vector perpendicular to normal and longitudinal direction in the right direction.
Definition: Wheel.h:132
float GetSuspensionLambda() const
Get the total impulse (N s) that was applied by the suspension.
Definition: Wheel.h:106
SubShapeID mContactSubShapeID
Sub shape ID for ground.
Definition: Wheel.h:125
RVec3 GetContactPosition() const
Returns the current contact position in world space (note by the time you call this the vehicle has m...
Definition: Wheel.h:85
Base class for wheel settings, each VehicleController can implement a derived class of this.
Definition: Wheel.h:19