EDITED
Hi,
I’m trying to display the xyz coordinates of an object that I can move to the console
Here’s my code
var speed = 5.0;
function Update () {
var x = Input.GetAxis("Horizontal") * Time.deltaTime * speed;
var z = Input.GetAxis ("Vertical") * Time.deltaTime * speed;
transform.Translate (x, 0, z);
Debug.Log (x, 0, z);
}
}
What am i doing wrong? Thanks much!
Debug.Log requires to get a string.
So in this case
Debug.Log( "(" + x + ",0," + z +")" );
ahh. the old string thing.
This seems to display the x,y and z coordinates but it doesn’t display the true current position of the game object. I think it is because of how the var X and var Z is defined (TimeDeltaTime * speed).
If I just wanted to display the current x y and z values of an object, how would I do this?
thanks
d
figured it out…
Debug.Log(transform.position);
thanks for the help too dreamora!
d