838 {
839 super.OnInput(dt);
840
841#ifdef DIAG_DEVELOPER
842 if (m_DebugMode == EMotorbikeDebugMode.NONE)
843 return;
844
847 {
849 {
852 }
854 {
856 }
857
858 return;
859 }
860
862
863 float thrustWanted = 0.0;
864 float steeringWanted = 0.0;
865
866 bool attemptSpeed = false;
867 float speedWanted = 0;
868
869 switch (m_DebugMode)
870 {
871 case EMotorbikeDebugMode.FORWARD_10:
872 attemptSpeed = true;
873 speedWanted = 10;
874 break;
875 case EMotorbikeDebugMode.FORWARD_50:
876 attemptSpeed = true;
877 speedWanted = 50;
878 break;
879 }
880
881 if (attemptSpeed)
882 {
883
885 }
886
888 bool isReverse =
GetGear() == CarGear.REVERSE;
889
890 if (isManual)
891 {
893
895 {
896 if (thrustWantedAbs > 0.1)
897 {
899 }
900 }
901 else if (
GetGear() > CarGear.FIRST && thrustWantedAbs < 0.1)
902 {
904 }
905 else if (
GetGear() < CarGear.FIRST || (thrustWanted > 0.0 && speed < 5.0))
906 {
908 }
909 }
910
916#endif
917 }
CarGearboxType
Enumerated gearbox types. (native, do not change or extend)
proto native void ShiftTo(int gear)
Shifts the future gear to selected gear, triggering gearbox simulation.
proto native void SetThrottle(float value)
Sets the future throttle value.
proto native float EngineGetRPMRedline()
Returns engine's maximal working rpm without damaging the engine.
proto native void SetHandbrake(float value)
Sets the future front brake value.
proto native CarGearboxType GearboxGetType()
Returns gearbox type. See CarGearboxType enum for more info.
proto native void SetKickstand(float value)
Sets the future kickstand value.
proto native void EngineStop()
Stops the engine.
proto native void SetBrake(float value)
Sets the future rear brake value.
proto native bool EngineIsOn()
Returns true when engine is running, false otherwise.
proto native float EngineGetRPMIdle()
Returns engine's idle rpm before engine stalls.
proto native void ShiftDown()
Shifts the future gear down, triggering gearbox simulation.
proto native void ShiftUp()
Shifts the future gear up, triggering gearbox simulation.
proto native void EngineStart()
Starts the engine.
proto native float EngineGetRPM()
Returns engine's rpm value.
proto native void SetSteering(float value)
Sets the future steering value.
proto native int GetGear()
Returns the index of the future gear, -1 if there is no engine.
float GetSpeedometerAbsolute()
Returns the current speed of the vehicle in km/h. Value is absolute.
static proto float Clamp(float value, float min, float max)
Clamps 'value' to 'min' if it is lower than 'min', or to 'max' if it is higher than 'max'.
static proto float InverseLerp(float a, float b, float value)
Calculates the linear value that produces the interpolant value within the range [a,...
static proto float AbsFloat(float f)
Returns absolute value.