- Home /
Kilometers per hour calc seems off
Hi Everyone,
I have a KPH meter that just seems to show way too high numbers. When it is showing 200kph it looks more like 50kph in the game.
My world is built using 1 unit = 1 m and the road textures are accurate enough in scale to judge I would say.
My calculation is placed in FixedUpdate() and is taken from another Answer from these pages,
float kph = rigidbody.velocity.magnitude * 3.6f;
Am I doing anything wrong?
Cheers Fred
Out of curiosity have you tried increasing your maximum allowed time step? It could be that the car is actually going at 200 kph but the computer is falling behind. Of course this could be way off base depending on your project.
Thanks for the suggestion. How does one know if this might be a problem? The 'game' currently is very simple ans is running a 60+ fps. Bu't I'll look into it.
I am sure you can figure out if this is the issue with a little investigating but its easier just to increase the maximum allowed time step and see if it improves the situation.
You can find this under... Edit > Project Settings > Time > $$anonymous$$aximum Allowed Timestep
Remember fixed update is independent of frame rate so it is possible to have low frame rate with a high fixed update rate.
It's probably a matter of perspective. If your textures and objects are a realistic size, then it should give the illusion of moving at a realistic speed.
Strip, I tried changing the max allowed time step but couldn't notice a difference.
Alucardj, I do think that I have my models and textures to scale pretty good. $$anonymous$$ight be a bit off but not massively. To be honest I only have the road texture at the moment, maybe with some more features and irregularities the impression will change.
Your answer
Follow this Question
Related Questions
Rotate Sprite based on Car Velocity Non GUI 3D Speedometer 0 Answers
Speedometer included to First Person Controller 1 Answer
how to setup speedoprefab 0 Answers
Unity3D - Get smooth speed and acceleration with GPS data 2 Answers
You are not allowed to call get_rigidbody when declaring a variable. 1 Answer