Hi. I’d like to add a speedometer to my driving sim, but I don’t know how to find out
what speed the car is travelling at.
Anyone know how to find out the speed of an object?
Thanks in advance.
Hi. I’d like to add a speedometer to my driving sim, but I don’t know how to find out
what speed the car is travelling at.
Anyone know how to find out the speed of an object?
Thanks in advance.
How are you moving your car in the first place? If you have a velocity vector, then the speed of the vehicle should simply be the length of that vector. If you have separate x- and y- (or x-, y-, and z-) velocity values, then simply make a vector of them and get the length of that.
If you don’t have access to the velocity of your car, you could perhaps measure the distance that it has moved since the last frame and use the formula “speed = distance/time” to find the speed. The following outline should work in most cases, I imagine:
Thanks for your help, but I found out that I could just do getCurrentSpeedKmHour () on bullet vehicles.