- Home /
How to get an Objects position per axis?
Okay I am trying to do something like this but I don't know how to pull an objects, say z axis, to continue the statement.
if (//Say z is 0.5f while ignoring the position of x and y)
{
//Do something
}
Comment
Best Answer
Answer by ShadyProductions · Feb 06, 2018 at 07:39 PM
gameObject.transform.position
is a Vector3 that has an x, y and z field.
var position = gameObject.transform.position;
if (position.x == 5) {
//do something
}
Perhaps you should take a look at the unity tutorials..