Vehicle speed in KM/H for speedometer

Recommended Posts

Hello,

I was wondering how the KM/H is calculated for speedometers.

The article mentions that KM/h could be calculated as getSpeed() (MP/s) * 3.6 basically, but for a more realistic result we could use a more complex formula, Math.ceil(getSpeed() * (getSpeed() / 20) * 2).

Why this post? I am curious what does this formula take into consideration? How did we get to it? Is it about how fast does the car feel at certain speeds?

After 130 KM/h (calculated with 3.6), the result with the alternative formula increases, so for example 200 KM/h (with 3.6) is 309 KM/h (with the alternative formula). Is it because at 200 KM/h the vehicle actually feels like it's going at ~300 KM/h, for example?

I hope I'm not too ambiguous, I'm basically trying to find out the logic behind the alternative formula.

Thank you very much!

Share on other sites

• 2 months later...

Hello

The RageMP framework provides two methods for calculating speed in GTA:

* Simple conversion: This method multiplies the car's speed in meters per second (getSpeed()) by 3.6 to get the speed in kilometers per hour (KM/h). This is a straightforward conversion and is easy to implement, but it doesn't account for the perceived feel of speed.

* Complex formula: This formula attempts to capture the perceived feel of speed by taking into account the car's speed at a given moment. It multiplies the speed by itself, divides by 20, and then multiplies by 2. The result is then rounded up using the Math.ceil function. This formula is more complex than the simple conversion, but it aims to provide a more realistic sense of how fast the car feels to the player.

Create an account

Register a new account