Hi All… I’m creating a a digital speedo for a project im working on… this is the script if i have atm.
//***Script Written By Andrew Laverack***//
using UnityEngine;
using System.Collections;
public class Speedo : MonoBehaviour {
public float speed;
public UILabel myLabel;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update ()
{
speed = Vector3.Dot(transform.forward, rigidbody.velocity);
myLabel.text = "KPH: " + speed;
}
}
Is there a way to actually get the speed to be calculated to KPH and stop all the .01324334 etc at the end of it… I want it to display like.
KPH: 102
Not KPH: 102.03032323123
Any help is appreciated.