Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
WheelSettings Class Reference

Base class for wheel settings, each VehicleController can implement a derived class of this. More...

#include <Wheel.h>

Inheritance diagram for WheelSettings:
SerializableObject RefTarget< WheelSettings > NonCopyable WheelSettingsTV WheelSettingsWV

Public Member Functions

virtual void SaveBinaryState (StreamOut &inStream) const
 Saves the contents in binary form to inStream.
 
virtual void RestoreBinaryState (StreamIn &inStream)
 Restores the contents in binary form to inStream.
 
- Public Member Functions inherited from SerializableObject
virtual ~SerializableObject ()=default
 Constructor.
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 
- Public Member Functions inherited from RefTarget< WheelSettings >
 RefTarget ()=default
 Constructor.
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator.
 
uint32 GetRefCount () const
 Get current refcount of this object.
 
void AddRef () const
 Add or release a reference to this object.
 
void Release () const
 

Public Attributes

Vec3 mPosition { 0, 0, 0 }
 Attachment point of wheel suspension in local space of the body.
 
Vec3 mSuspensionForcePoint { 0, 0, 0 }
 Where tire forces (suspension and traction) are applied, in local space of the body. A good default is the center of the wheel in its neutral pose. See mEnableSuspensionForcePoint.
 
Vec3 mSuspensionDirection { 0, -1, 0 }
 Direction of the suspension in local space of the body, should point down.
 
Vec3 mSteeringAxis { 0, 1, 0 }
 Direction of the steering axis in local space of the body, should point up (e.g. for a bike would be -mSuspensionDirection)
 
Vec3 mWheelUp { 0, 1, 0 }
 Up direction when the wheel is in the neutral steering position (usually VehicleConstraintSettings::mUp but can be used to give the wheel camber or for a bike would be -mSuspensionDirection)
 
Vec3 mWheelForward { 0, 0, 1 }
 Forward direction when the wheel is in the neutral steering position (usually VehicleConstraintSettings::mForward but can be used to give the wheel toe, does not need to be perpendicular to mWheelUp)
 
float mSuspensionMinLength = 0.3f
 How long the suspension is in max raised position relative to the attachment point (m)
 
float mSuspensionMaxLength = 0.5f
 How long the suspension is in max droop position relative to the attachment point (m)
 
float mSuspensionPreloadLength = 0.0f
 The natural length (m) of the suspension spring is defined as mSuspensionMaxLength + mSuspensionPreloadLength. Can be used to preload the suspension as the spring is compressed by mSuspensionPreloadLength when the suspension is in max droop position. Note that this means when the vehicle touches the ground there is a discontinuity so it will also make the vehicle more bouncy as we're updating with discrete time steps.
 
SpringSettings mSuspensionSpring { ESpringMode::FrequencyAndDamping, 1.5f, 0.5f }
 Settings for the suspension spring.
 
float mRadius = 0.3f
 Radius of the wheel (m)
 
float mWidth = 0.1f
 Width of the wheel (m)
 
bool mEnableSuspensionForcePoint = false
 Enables mSuspensionForcePoint, if disabled, the forces are applied at the collision contact point. This leads to a more accurate simulation when interacting with dynamic objects but makes the vehicle less stable. When setting this to true, all forces will be applied to a fixed point on the vehicle body.
 

Additional Inherited Members

- Static Public Member Functions inherited from RefTarget< WheelSettings >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION.
 
- Protected Attributes inherited from RefTarget< WheelSettings >
atomic< uint32mRefCount
 Current reference count.
 
- Static Protected Attributes inherited from RefTarget< WheelSettings >
static constexpr uint32 cEmbedded
 A large value that gets added to the refcount to mark the object as embedded.
 

Detailed Description

Base class for wheel settings, each VehicleController can implement a derived class of this.

Member Function Documentation

◆ RestoreBinaryState()

void WheelSettings::RestoreBinaryState ( StreamIn inStream)
virtual

Restores the contents in binary form to inStream.

Reimplemented in WheelSettingsTV, and WheelSettingsWV.

◆ SaveBinaryState()

void WheelSettings::SaveBinaryState ( StreamOut inStream) const
virtual

Saves the contents in binary form to inStream.

Reimplemented in WheelSettingsTV, and WheelSettingsWV.

Member Data Documentation

◆ mEnableSuspensionForcePoint

bool WheelSettings::mEnableSuspensionForcePoint = false

Enables mSuspensionForcePoint, if disabled, the forces are applied at the collision contact point. This leads to a more accurate simulation when interacting with dynamic objects but makes the vehicle less stable. When setting this to true, all forces will be applied to a fixed point on the vehicle body.

◆ mPosition

Vec3 WheelSettings::mPosition { 0, 0, 0 }

Attachment point of wheel suspension in local space of the body.

◆ mRadius

float WheelSettings::mRadius = 0.3f

Radius of the wheel (m)

◆ mSteeringAxis

Vec3 WheelSettings::mSteeringAxis { 0, 1, 0 }

Direction of the steering axis in local space of the body, should point up (e.g. for a bike would be -mSuspensionDirection)

◆ mSuspensionDirection

Vec3 WheelSettings::mSuspensionDirection { 0, -1, 0 }

Direction of the suspension in local space of the body, should point down.

◆ mSuspensionForcePoint

Vec3 WheelSettings::mSuspensionForcePoint { 0, 0, 0 }

Where tire forces (suspension and traction) are applied, in local space of the body. A good default is the center of the wheel in its neutral pose. See mEnableSuspensionForcePoint.

◆ mSuspensionMaxLength

float WheelSettings::mSuspensionMaxLength = 0.5f

How long the suspension is in max droop position relative to the attachment point (m)

◆ mSuspensionMinLength

float WheelSettings::mSuspensionMinLength = 0.3f

How long the suspension is in max raised position relative to the attachment point (m)

◆ mSuspensionPreloadLength

float WheelSettings::mSuspensionPreloadLength = 0.0f

The natural length (m) of the suspension spring is defined as mSuspensionMaxLength + mSuspensionPreloadLength. Can be used to preload the suspension as the spring is compressed by mSuspensionPreloadLength when the suspension is in max droop position. Note that this means when the vehicle touches the ground there is a discontinuity so it will also make the vehicle more bouncy as we're updating with discrete time steps.

◆ mSuspensionSpring

SpringSettings WheelSettings::mSuspensionSpring { ESpringMode::FrequencyAndDamping, 1.5f, 0.5f }

Settings for the suspension spring.

◆ mWheelForward

Vec3 WheelSettings::mWheelForward { 0, 0, 1 }

Forward direction when the wheel is in the neutral steering position (usually VehicleConstraintSettings::mForward but can be used to give the wheel toe, does not need to be perpendicular to mWheelUp)

◆ mWheelUp

Vec3 WheelSettings::mWheelUp { 0, 1, 0 }

Up direction when the wheel is in the neutral steering position (usually VehicleConstraintSettings::mUp but can be used to give the wheel camber or for a bike would be -mSuspensionDirection)

◆ mWidth

float WheelSettings::mWidth = 0.1f

Width of the wheel (m)


The documentation for this class was generated from the following files: