SA-MP Forums Archive
[HELP] Calculate the vehicle speed (km/h) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Calculate the vehicle speed (km/h) (/showthread.php?tid=159837)



[HELP] Calculate the vehicle speed (km/h) - FMK - 14.07.2010

Hello guys,

How I caltulate the vehicle speed as km/h?


Re: [HELP] Calculate the vehicle speed (km/h) - RyDeR` - 14.07.2010

Formula:
√ ((X ^ 2) + (Y ^ 2) + (Z ^ 2))

Now just multiply with a value to become a correct speed.


Re: [HELP] Calculate the vehicle speed (km/h) - [DK]JaloNik - 14.07.2010

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
Formula:
√ ((X ^ 2) + (Y ^ 2) + (Z ^ 2))

Now just multiply with a value to become a correct speed.
LOL XDDDD Omg, Ryder!


Re: [HELP] Calculate the vehicle speed (km/h) - DeathOnaStick - 14.07.2010

Quote:
Originally Posted by RyDeR`
Посмотреть сообщение
Formula:
√ ((X ^ 2) + (Y ^ 2) + (Z ^ 2))

Now just multiply with a value to become a correct speed.
1. "with a value" What kind of value?
2. What is this formula based on?
3. There are 3 values, wouldnt it be logical that there is a cube root instead of a square root? (might be solved with point 2 )

Sry but i am sort of curious, i dont wanna use smth without knowing the background (although i didnt start this topic )


Re: [HELP] Calculate the vehicle speed (km/h) - [XST]O_x - 14.07.2010

Should look something like this?
pawn Код:
floatsqroot(floatpower(floatabs(X), 2.0) + floatpower(floatabs(Y), 2.0) + floatpower(floatabs(Z), 2.0))



Re: [HELP] Calculate the vehicle speed (km/h) - Kar - 14.07.2010

pawn Код:
Speed = floatmul(floatsqroot(floatadd(floatadd(floatpower(X, 2), floatpower(Y, 2)),  floatpower(Z, 2))), 200.0); //100.0
[EDIT] crap thats mph lol sorry