Position of empty game objects
I have a piece of code that relies heavily on two empty gameobjects either being in the same or in different positions. These game objects are the children of children of a prefab. In the inspector, if I take away their parentage, they are shown to be in the exact same position. When I run my code on these same two pieces (with parentage because the code relies on some information from the parents) the code comes back saying that the pieces are some distance away from each other. The distance varies wildly when looking at the 60-ish points in comparison to each other, but the distances are the same each time I run the code (If two points are said to be .25 away from each other, they will always say that. The next pair will always say 5, and the next will always say 2.10238 (these are a few of the distances returning)). Needless to say, I am very confused. What would cause this and how can I fix it? Thanks.
EDIT: Still have not found solution. Mostly, the points seem to be spreading out linearly. The empty objects attached to things rotated 90 degrees tend to stay in line with the rest of the rotated 90 degrees, etc.
Answer by ldeboer · Dec 07, 2015 at 07:20 AM
If you want the local position of the children to it's parent then use
transform.localPosition
http://docs.unity3d.com/ScriptReference/Transform-localPosition.html
No, I want them in global space. It's just that the inspector shows it in local space so it's very hard to tell how the points are moving wrong.