51 void Set(
int inCurrentGear,
float inClutchFriction) { mCurrentGear = inCurrentGear; mClutchFriction = inClutchFriction; }
58 void Update(
float inDeltaTime,
float inCurrentRPM,
float inForwardInput,
bool inCanShiftUp);
78 float mClutchFriction = 1.0f;
79 float mGearSwitchTimeLeft = 0.0f;
80 float mClutchReleaseTimeLeft = 0.0f;
81 float mGearSwitchLatencyTimeLeft = 0.0f;
#define JPH_NAMESPACE_END
Definition Core.h:240
uint8_t uint8
Definition Core.h:310
#define JPH_NAMESPACE_BEGIN
Definition Core.h:234
std::vector< T, STLAllocator< T > > Array
Definition STLAllocator.h:81
#define JPH_DECLARE_SERIALIZABLE_NON_VIRTUAL(class_name)
Definition SerializableObject.h:71
ETransmissionMode
How gears are shifted.
Definition VehicleTransmission.h:16
@ Auto
Automatically shift gear up and down.
@ Manual
Manual gear shift (call SetTransmissionInput)
Definition StateRecorder.h:15
Simple binary input stream.
Definition StreamIn.h:11
Simple binary output stream.
Definition StreamOut.h:11
Runtime data for transmission.
Definition VehicleTransmission.h:46
void RestoreState(StateRecorder &inStream)
Definition VehicleTransmission.cpp:150
int GetCurrentGear() const
Current gear, -1 = reverse, 0 = neutral, 1 = 1st gear etc.
Definition VehicleTransmission.h:61
float GetClutchFriction() const
Value between 0 and 1 indicating how much friction the clutch gives (0 = no friction,...
Definition VehicleTransmission.h:64
void Set(int inCurrentGear, float inClutchFriction)
Definition VehicleTransmission.h:51
void SaveState(StateRecorder &inStream) const
Saving state for replay.
Definition VehicleTransmission.cpp:141
float GetCurrentRatio() const
Return the transmission ratio based on the current gear (ratio between engine and differential)
Definition VehicleTransmission.cpp:131
void Update(float inDeltaTime, float inCurrentRPM, float inForwardInput, bool inCanShiftUp)
Definition VehicleTransmission.cpp:51
bool IsSwitchingGear() const
If the auto box is currently switching gears.
Definition VehicleTransmission.h:67
Configuration for the transmission of a vehicle (gear box)
Definition VehicleTransmission.h:23
float mClutchReleaseTime
How long it takes to release the clutch (go to full friction), only used in auto mode.
Definition VehicleTransmission.h:37
void RestoreBinaryState(StreamIn &inStream)
Restores the contents in binary form to inStream.
Definition VehicleTransmission.cpp:38
Array< float > mGearRatios
Ratio in rotation rate between engine and gear box, first element is 1st gear, 2nd element 2nd gear e...
Definition VehicleTransmission.h:34
ETransmissionMode mMode
How to switch gears.
Definition VehicleTransmission.h:33
float mClutchStrength
Strength of the clutch when fully engaged. Total torque a clutch applies is Torque = ClutchStrength *...
Definition VehicleTransmission.h:41
float mSwitchLatency
How long to wait after releasing the clutch before another switch is attempted (s),...
Definition VehicleTransmission.h:38
float mShiftUpRPM
If RPM of engine is bigger then this we will shift a gear up, only used in auto mode.
Definition VehicleTransmission.h:39
float mShiftDownRPM
If RPM of engine is smaller then this we will shift a gear down, only used in auto mode.
Definition VehicleTransmission.h:40
Array< float > mReverseGearRatios
Ratio in rotation rate between engine and gear box when driving in reverse.
Definition VehicleTransmission.h:35
void SaveBinaryState(StreamOut &inStream) const
Saves the contents in binary form to inStream.
Definition VehicleTransmission.cpp:25
float mSwitchTime
How long it takes to switch gears (s), only used in auto mode.
Definition VehicleTransmission.h:36