Can I get some world direction and import to my GameObject?
For example, i have 2 boxes, the first has the Y Axis pointing up, and the second has the Y Axis pointing down, but I don’t know which one is the one, Can I get some sort of world vector like a -Y of the world, wich is pointing down, and “import” it to my GameObject, and when i translate them both will go down.
transform.up = Vector3.up;
never tried it so it might not work, but transform.up is the up vector of the transform, Vector3.up is global up vector… you could compare them and if they’re not the same work out a rotation to apply if that code doesn’t work.
Also, you will need to check the direction.
bool isUp = Vector3.Dot(transform.up, Vector3.up) > 0;
Dot is a directional based number. The farther away from “pointing in the same direction” you get, the lower the number. If you are specifically dealing in normals (or 1 length vectors) then you will get a number between 1 and -1. 1 being pointing the same direction and -1 being pointing the opposite direction. Zero is pointing in a direction that is perpendicular to the normal.
Dot also works with longer vectors, but the numbers become bigger (or smaller) depending on the distance.
And yes… transform.up = Vector3.up works just fine. you just don’t have a facing direction.