Car speed calculus

Blitz3D Forums/Blitz3D Programming/Car speed calculus

..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?

What physics engine are you useing

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?

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.

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..

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