Car speed calculus

Blitz3D Forums/Blitz3D Programming/Car speed calculus

Naughty Alien(Posted 2008) [#1]
..I have car properly set with physics and stuff..its working just fine, but, how to properly calculate car speed? I mean what should be reference point?? What i want is actually to hold in balance torque on wheels according to current speed but im a bit confused how to measure speed of my car body?


Nate the Great(Posted 2008) [#2]
What physics engine are you useing


Gabriel(Posted 2008) [#3]
Assuming that your units of measurement are seconds and metres, can't you just calculate how far it moves each frame and then once a second, total it up and multiply out to get from metres per second to kilometres per hour?


Stevie G(Posted 2008) [#4]
As Gabriel suggests - you could just store the last position position and the distance between the current and last position is the velocity during that frame.


Naughty Alien(Posted 2008) [#5]
Im using Physx, and i need accurate speed in order to properly set drifting factor as well as friction between tyres and different type of ground..units im using are meters/seconds..your suggestion sound nice Gabriel..Ill give it a try..


Santiworld(Posted 2008) [#6]
i calculate the longitudinal distance between the (current position) and (last position).... allways using the same period of millisecs... no frames( because the frames depend of each computer)

speed = dist(long_advance)* / time(millisecs)

*the lateral speed should not be computed in the speed variable

saludos
santiago