- Home /
Objects local/world cordinate question
when i put in zero zero for each of the objects, they show up in diff areas of the scene. I'm becoming confused with local and world and I"m trying to spawn something at a position but when it spawns it's off .
Answer by Borgo · Feb 04, 2011 at 11:22 AM
In the inspector, the positions is relative to they parent, unless they don't have parent. If the object don't have a parent, so, the positions are global.
In scrit you write for example:
transform.localPosition.x = 0;
With this, your object will be at same parent x axis.
Otherwise, if you write this:
tranform.position.x = 0;
Your object will be moved to the center of the scene on the x axis, but, if the parent move the x position, your object will be moved together.
A observation about rotation:
you will see somethimes something like this: you used a script to move the object local position on x axis, but the object is moving in another axis, it's because the rotation of parent, for example, if the parent y axis are rotated 90 to any side, when moving the child object local position in x axis will move globaly in the z axis.
Edit
See my answer in your other question:
http://answers.unity3d.com/questions/39982/help-with-local-world-positiong-a-new-gameobject
Your answer
Follow this Question
Related Questions
Instantiate and destroy on given location 1 Answer
world and local locations.. 1 Answer
Trying to get a shoot function working in unity using instantiate and it isn't working. 1 Answer
getting GameObject from Array and then instantiating 2 Answers
1stPersonController bigger than World. HELP PLS :( 3 Answers