![]() |
Jolt Physics
A multi core friendly Game Physics Engine
|
Runtime data for transmission. More...
#include <VehicleTransmission.h>
Public Member Functions | |
| void | Set (int inCurrentGear, float inClutchFriction) |
| void | Update (float inDeltaTime, float inCurrentRPM, float inForwardInput, bool inCanShiftUp) |
| int | GetCurrentGear () const |
| Current gear, -1 = reverse, 0 = neutral, 1 = 1st gear etc. | |
| float | GetClutchFriction () const |
| Value between 0 and 1 indicating how much friction the clutch gives (0 = no friction, 1 = full friction) | |
| bool | IsSwitchingGear () const |
| If the auto box is currently switching gears. | |
| float | GetCurrentRatio () const |
| Return the transmission ratio based on the current gear (ratio between engine and differential) | |
| bool | AllowSleep () const |
| Only allow sleeping when the transmission is idle. | |
| void | SaveState (StateRecorder &inStream) const |
| Saving state for replay. | |
| void | RestoreState (StateRecorder &inStream) |
Public Member Functions inherited from VehicleTransmissionSettings | |
| void | SaveBinaryState (StreamOut &inStream) const |
| Saves the contents in binary form to inStream. | |
| void | RestoreBinaryState (StreamIn &inStream) |
| Restores the contents in binary form to inStream. | |
Additional Inherited Members | |
Public Attributes inherited from VehicleTransmissionSettings | |
| ETransmissionMode | mMode = ETransmissionMode::Auto |
| How to switch gears. | |
| Array< float > | mGearRatios { 2.66f, 1.78f, 1.3f, 1.0f, 0.74f } |
| Ratio in rotation rate between engine and gear box, first element is 1st gear, 2nd element 2nd gear etc. | |
| Array< float > | mReverseGearRatios { -2.90f } |
| Ratio in rotation rate between engine and gear box when driving in reverse. | |
| float | mSwitchTime = 0.5f |
| How long it takes to switch gears (s), only used in auto mode. | |
| float | mClutchReleaseTime = 0.3f |
| How long it takes to release the clutch (go to full friction), only used in auto mode. | |
| float | mSwitchLatency = 0.5f |
| How long to wait after releasing the clutch before another switch is attempted (s), only used in auto mode. | |
| float | mShiftUpRPM = 4000.0f |
| If RPM of engine is bigger then this we will shift a gear up, only used in auto mode. | |
| float | mShiftDownRPM = 2000.0f |
| If RPM of engine is smaller then this we will shift a gear down, only used in auto mode. | |
| float | mClutchStrength = 10.0f |
| Strength of the clutch when fully engaged. Total torque a clutch applies is Torque = ClutchStrength * (Velocity Engine - Avg Velocity Wheels At Clutch) (units: k m^2 s^-1) | |
Runtime data for transmission.
|
inline |
Only allow sleeping when the transmission is idle.
|
inline |
Value between 0 and 1 indicating how much friction the clutch gives (0 = no friction, 1 = full friction)
|
inline |
Current gear, -1 = reverse, 0 = neutral, 1 = 1st gear etc.
| float VehicleTransmission::GetCurrentRatio | ( | ) | const |
Return the transmission ratio based on the current gear (ratio between engine and differential)
|
inline |
If the auto box is currently switching gears.
| void VehicleTransmission::RestoreState | ( | StateRecorder & | inStream | ) |
| void VehicleTransmission::SaveState | ( | StateRecorder & | inStream | ) | const |
Saving state for replay.
Set input from driver regarding the transmission (only relevant when transmission is set to manual mode)
| inCurrentGear | Current gear, -1 = reverse, 0 = neutral, 1 = 1st gear etc. |
| inClutchFriction | Value between 0 and 1 indicating how much friction the clutch gives (0 = no friction, 1 = full friction) |
| void VehicleTransmission::Update | ( | float | inDeltaTime, |
| float | inCurrentRPM, | ||
| float | inForwardInput, | ||
| bool | inCanShiftUp ) |
Update the current gear and clutch friction if the transmission is in auto mode
| inDeltaTime | Time step delta time in s |
| inCurrentRPM | Current RPM for engine |
| inForwardInput | Hint if the user wants to drive forward (> 0) or backwards (< 0) |
| inCanShiftUp | Indicates if we want to allow the transmission to shift up (e.g. pass false if wheels are slipping) |