Is it possible to do this?
I can’t seem to find out…
if(gameobject.position == (0,0,0))
{
debug.log("test")
}
or something like that anyways?
Is it possible to do this?
I can’t seem to find out…
if(gameobject.position == (0,0,0))
{
debug.log("test")
}
or something like that anyways?
It would be like this:
if(gameObject.transform.position == Vector3(0,0,0))
{
debug.log("test")
}
In C# you would have to add ‘new’ in front of the Vector3(). Note that in programming it is usually not a good thing to directly compare floating point numbers (and a the x, y, and z components of a Vector3 are floating point numbers). A direct comparison of Vector3s works in Unity because under the hood Unity is checking to see if the two values are within a small threshold distance from each other. This makes a lot of code work well, but you will not necessarily have exactly the same values. FYI: Vector3.zero is shorthand for Vector3(0.0, 0.0, 0.0).