system
April 22, 2011, 2:32am
1
Hi, I'm displaying the camera World coordinates using the below code which works well but it displays a string of decimals. How can I reduce the string to single Numbers, thanks?
function OnGUI () {
GUI.Label (Rect (10,10,500,100), " X= " + transform.position.x + " Y= " + transform.position.y + " Z= " + transform.position.z);
}
system
April 22, 2011, 2:49am
2
Heres What I would do
private var xPosition : int;
private var yPosition : int;
private var zPosition : int;
function Update () {
xPosition = transform.position.x;
yPosition = transform.position.y;
zPosition = transform.position.z;
}
function OnGUI () {
GUI.Label (Rect (10,30,500,100), " X= " + xPosition + " Y= " + yPosition + " Z= " + zPosition);
}