- Home /
How to cut numbers after decimal point in coordinates?
I made coordinates, but they show me x: 203.0352468 etc how to cut it just to the number before decimal point like that: x: 203 etc Here's the code:
private Vector3 playerPos;
private float xcord;
private float ycord;
private float zcord;
void Update () {
playerPos = new Vector3(transform.position.x, transform.position.y, transform.position.z);
xcord = playerPos.x;
ycord = playerPos.y;
zcord = playerPos.z;
}
void OnGUI () {
GUI.Box(new Rect(Screen.width/2, Screen.height/2, Screen.width/5, Screen.height/2), "x: " + xcord + " y: " + ycord + " z: " + zcord);
}
Comment