- Home /
Speedometer
Hy All i want ask.. i use this script for my car speedometer
var mphDisplay : GUIText;
var mph = rigidbody.velocity.magnitude *2.0; mphDisplay.text = mph + " Mph";
In the game showing 0.000 Mph not as I would expect such as 0 Mph How to change this script. when the car is running at a speed of eg 120 Mph, Speedometer will show 120 Mph without the numbers behind eg 120.0010 Mph?
Answer by Rmaniac · Aug 03, 2011 at 04:11 PM
Try Math.floor() to truncate decimals:
mphDisplay.text = Math.floor(mph) + "Mph";
unknown identifier $$anonymous$$ath bro...Is there another solution?
I Try this mphDisplay.text = $$anonymous$$athf.Floor(mph) + "$$anonymous$$ph"; and working thanks bro :)
Your answer
Follow this Question
Related Questions
Ending game after finishing chekpoint 3 Answers
Car speedometer MPH 1 Answer
How do I download the new unity 5 car tutor? 1 Answer
Racing Game - setting up a car TIRES 1 Answer