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

Runtime controller class for vehicle with tank tracks. More...

#include <TrackedVehicleController.h>

Inheritance diagram for TrackedVehicleController:
VehicleController RefTarget< VehicleController > NonCopyable

Public Member Functions

JPH_OVERRIDE_NEW_DELETE TrackedVehicleController (const TrackedVehicleControllerSettings &inSettings, VehicleConstraint &inConstraint)
 Constructor. More...
 
void SetDriverInput (float inForward, float inLeftRatio, float inRightRatio, float inBrake)
 
void SetForwardInput (float inForward)
 Value between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving direction and amount the gas pedal is pressed. More...
 
float GetForwardInput () const
 
void SetLeftRatio (float inLeftRatio)
 Value between -1 and 1 indicating an extra multiplier to the rotation rate of the left track (used for steering) More...
 
float GetLeftRatio () const
 
void SetRightRatio (float inRightRatio)
 Value between -1 and 1 indicating an extra multiplier to the rotation rate of the right track (used for steering) More...
 
float GetRightRatio () const
 
void SetBrakeInput (float inBrake)
 Value between 0 and 1 indicating how strong the brake pedal is pressed. More...
 
float GetBrakeInput () const
 
const VehicleEngineGetEngine () const
 Get current engine state. More...
 
VehicleEngineGetEngine ()
 Get current engine state (writable interface, allows you to make changes to the configuration which will take effect the next time step) More...
 
const VehicleTransmissionGetTransmission () const
 Get current transmission state. More...
 
VehicleTransmissionGetTransmission ()
 Get current transmission state (writable interface, allows you to make changes to the configuration which will take effect the next time step) More...
 
const VehicleTracksGetTracks () const
 Get the tracks this vehicle has. More...
 
VehicleTracksGetTracks ()
 Get the tracks this vehicle has (writable interface, allows you to make changes to the configuration which will take effect the next time step) More...
 
void SetRPMMeter (Vec3Arg inPosition, float inSize)
 Debug drawing of RPM meter. More...
 
- Public Member Functions inherited from VehicleController
JPH_OVERRIDE_NEW_DELETE VehicleController (VehicleConstraint &inConstraint)
 Constructor / destructor. More...
 
virtual ~VehicleController ()=default
 
- Public Member Functions inherited from RefTarget< VehicleController >
 RefTarget ()=default
 Constructor. More...
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us More...
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator. More...
 
uint32 GetRefCount () const
 Get current refcount of this object. More...
 
void AddRef () const
 Add or release a reference to this object. More...
 
void Release () const
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 

Protected Member Functions

void SyncLeftRightTracks ()
 Synchronize angular velocities of left and right tracks according to their ratios. More...
 
virtual WheelConstructWheel (const WheelSettings &inWheel) const override
 
virtual bool AllowSleep () const override
 
virtual void PreCollide (float inDeltaTime, PhysicsSystem &inPhysicsSystem) override
 
virtual void PostCollide (float inDeltaTime, PhysicsSystem &inPhysicsSystem) override
 
virtual bool SolveLongitudinalAndLateralConstraints (float inDeltaTime) override
 
virtual void SaveState (StateRecorder &inStream) const override
 
virtual void RestoreState (StateRecorder &inStream) override
 
virtual void Draw (DebugRenderer *inRenderer) const override
 
virtual WheelConstructWheel (const WheelSettings &inWheel) const =0
 
virtual bool AllowSleep () const =0
 
virtual void PreCollide (float inDeltaTime, PhysicsSystem &inPhysicsSystem)=0
 
virtual void PostCollide (float inDeltaTime, PhysicsSystem &inPhysicsSystem)=0
 
virtual bool SolveLongitudinalAndLateralConstraints (float inDeltaTime)=0
 
virtual void SaveState (StateRecorder &inStream) const =0
 
virtual void RestoreState (StateRecorder &inStream)=0
 
virtual void Draw (DebugRenderer *inRenderer) const =0
 

Protected Attributes

float mForwardInput = 0.0f
 Value between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving direction and amount the gas pedal is pressed. More...
 
float mLeftRatio = 1.0f
 Value between -1 and 1 indicating an extra multiplier to the rotation rate of the left track (used for steering) More...
 
float mRightRatio = 1.0f
 Value between -1 and 1 indicating an extra multiplier to the rotation rate of the right track (used for steering) More...
 
float mBrakeInput = 0.0f
 Value between 0 and 1 indicating how strong the brake pedal is pressed. More...
 
VehicleEngine mEngine
 Engine state of the vehicle. More...
 
VehicleTransmission mTransmission
 Transmission state of the vehicle. More...
 
VehicleTracks mTracks
 Tracks of the vehicle. More...
 
Vec3 mRPMMeterPosition { 0, 1, 0 }
 Position (in local space of the body) of the RPM meter when drawing the constraint. More...
 
float mRPMMeterSize = 0.5f
 Size of the RPM meter when drawing the constraint. More...
 
- Protected Attributes inherited from VehicleController
VehicleConstraintmConstraint
 The vehicle constraint we belong to. More...
 
- Protected Attributes inherited from RefTarget< VehicleController >
atomic< uint32mRefCount
 Current reference count. More...
 

Additional Inherited Members

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

Detailed Description

Runtime controller class for vehicle with tank tracks.

Constructor & Destructor Documentation

◆ TrackedVehicleController()

TrackedVehicleController::TrackedVehicleController ( const TrackedVehicleControllerSettings inSettings,
VehicleConstraint inConstraint 
)

Constructor.

Member Function Documentation

◆ AllowSleep()

bool TrackedVehicleController::AllowSleep ( ) const
overrideprotectedvirtual

Implements VehicleController.

◆ ConstructWheel()

virtual Wheel * TrackedVehicleController::ConstructWheel ( const WheelSettings inWheel) const
inlineoverrideprotectedvirtual

Implements VehicleController.

◆ Draw()

void TrackedVehicleController::Draw ( DebugRenderer inRenderer) const
overrideprotectedvirtual

Implements VehicleController.

◆ GetBrakeInput()

float TrackedVehicleController::GetBrakeInput ( ) const
inline

◆ GetEngine() [1/2]

VehicleEngine & TrackedVehicleController::GetEngine ( )
inline

Get current engine state (writable interface, allows you to make changes to the configuration which will take effect the next time step)

◆ GetEngine() [2/2]

const VehicleEngine & TrackedVehicleController::GetEngine ( ) const
inline

Get current engine state.

◆ GetForwardInput()

float TrackedVehicleController::GetForwardInput ( ) const
inline

◆ GetLeftRatio()

float TrackedVehicleController::GetLeftRatio ( ) const
inline

◆ GetRightRatio()

float TrackedVehicleController::GetRightRatio ( ) const
inline

◆ GetTracks() [1/2]

VehicleTracks & TrackedVehicleController::GetTracks ( )
inline

Get the tracks this vehicle has (writable interface, allows you to make changes to the configuration which will take effect the next time step)

◆ GetTracks() [2/2]

const VehicleTracks & TrackedVehicleController::GetTracks ( ) const
inline

Get the tracks this vehicle has.

◆ GetTransmission() [1/2]

VehicleTransmission & TrackedVehicleController::GetTransmission ( )
inline

Get current transmission state (writable interface, allows you to make changes to the configuration which will take effect the next time step)

◆ GetTransmission() [2/2]

const VehicleTransmission & TrackedVehicleController::GetTransmission ( ) const
inline

Get current transmission state.

◆ PostCollide()

void TrackedVehicleController::PostCollide ( float  inDeltaTime,
PhysicsSystem inPhysicsSystem 
)
overrideprotectedvirtual

Implements VehicleController.

◆ PreCollide()

void TrackedVehicleController::PreCollide ( float  inDeltaTime,
PhysicsSystem inPhysicsSystem 
)
overrideprotectedvirtual

Implements VehicleController.

◆ RestoreState()

void TrackedVehicleController::RestoreState ( StateRecorder inStream)
overrideprotectedvirtual

Implements VehicleController.

◆ SaveState()

void TrackedVehicleController::SaveState ( StateRecorder inStream) const
overrideprotectedvirtual

Implements VehicleController.

◆ SetBrakeInput()

void TrackedVehicleController::SetBrakeInput ( float  inBrake)
inline

Value between 0 and 1 indicating how strong the brake pedal is pressed.

◆ SetDriverInput()

void TrackedVehicleController::SetDriverInput ( float  inForward,
float  inLeftRatio,
float  inRightRatio,
float  inBrake 
)
inline

Set input from driver

Parameters
inForwardValue between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving direction and amount the gas pedal is pressed
inLeftRatioValue between -1 and 1 indicating an extra multiplier to the rotation rate of the left track (used for steering)
inRightRatioValue between -1 and 1 indicating an extra multiplier to the rotation rate of the right track (used for steering)
inBrakeValue between 0 and 1 indicating how strong the brake pedal is pressed

◆ SetForwardInput()

void TrackedVehicleController::SetForwardInput ( float  inForward)
inline

Value between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving direction and amount the gas pedal is pressed.

◆ SetLeftRatio()

void TrackedVehicleController::SetLeftRatio ( float  inLeftRatio)
inline

Value between -1 and 1 indicating an extra multiplier to the rotation rate of the left track (used for steering)

◆ SetRightRatio()

void TrackedVehicleController::SetRightRatio ( float  inRightRatio)
inline

Value between -1 and 1 indicating an extra multiplier to the rotation rate of the right track (used for steering)

◆ SetRPMMeter()

void TrackedVehicleController::SetRPMMeter ( Vec3Arg  inPosition,
float  inSize 
)
inline

Debug drawing of RPM meter.

◆ SolveLongitudinalAndLateralConstraints()

bool TrackedVehicleController::SolveLongitudinalAndLateralConstraints ( float  inDeltaTime)
overrideprotectedvirtual

Implements VehicleController.

◆ SyncLeftRightTracks()

void TrackedVehicleController::SyncLeftRightTracks ( )
protected

Synchronize angular velocities of left and right tracks according to their ratios.

Member Data Documentation

◆ mBrakeInput

float TrackedVehicleController::mBrakeInput = 0.0f
protected

Value between 0 and 1 indicating how strong the brake pedal is pressed.

◆ mEngine

VehicleEngine TrackedVehicleController::mEngine
protected

Engine state of the vehicle.

◆ mForwardInput

float TrackedVehicleController::mForwardInput = 0.0f
protected

Value between -1 and 1 for auto transmission and value between 0 and 1 indicating desired driving direction and amount the gas pedal is pressed.

◆ mLeftRatio

float TrackedVehicleController::mLeftRatio = 1.0f
protected

Value between -1 and 1 indicating an extra multiplier to the rotation rate of the left track (used for steering)

◆ mRightRatio

float TrackedVehicleController::mRightRatio = 1.0f
protected

Value between -1 and 1 indicating an extra multiplier to the rotation rate of the right track (used for steering)

◆ mRPMMeterPosition

Vec3 TrackedVehicleController::mRPMMeterPosition { 0, 1, 0 }
protected

Position (in local space of the body) of the RPM meter when drawing the constraint.

◆ mRPMMeterSize

float TrackedVehicleController::mRPMMeterSize = 0.5f
protected

Size of the RPM meter when drawing the constraint.

◆ mTracks

VehicleTracks TrackedVehicleController::mTracks
protected

Tracks of the vehicle.

◆ mTransmission

VehicleTransmission TrackedVehicleController::mTransmission
protected

Transmission state of the vehicle.


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