Hello
noob question here.
I have a cube. I want to output/print to the console whenever my cube moves above a specific value in the y axis (up). So basically how do I detect position.
Br Hamid
Hello
noob question here.
I have a cube. I want to output/print to the console whenever my cube moves above a specific value in the y axis (up). So basically how do I detect position.
Br Hamid
In your update function, on the cube, just check the gameObject.transform.position.y, if it is greater than the y value you are checking for output to the console…
Thank you.
so could I write this in the update
if ( gameObject.transform.position.y > 20)
{
print(“Cube is above 20 units on y”);
}
Yes, but replace print… with Debug.Log("Cube is above 20 units on y”);