Ok, I have been pounding my head against the wall and can’t seem to find the position of a child object.
I have a model named ‘shapegroup’.
That model has children named
myshapes_myCircle
myshapes_myCone
myshapes_mySquare.
I have shapegroup positioned at 0,0,0.
When I check the positions of each of the children… they all come back the same as the parent - which as you can see from the image below… all of them are in different positions
Here is the code I am running:
public class getPositions : MonoBehaviour {
public GameObject shapegroup;
// Use this for initialization
void Start () {
shapegroup = GameObject.Find ("shapegroup");
reportTransform (shapegroup.transform.position, shapegroup.name);
foreach (Component c in shapegroup.GetComponentInChildren<Transform>()) {
reportTransform(c.transform.position, c.name);
}
}
void reportTransform(Vector3 trans, string transName){
Debug.Log ("This is "+transName+ " X:"+trans.x.ToString()+" Y:"+trans.y.ToString()+" Z:"+trans.y.ToString());
}
}
And here are the results…
How do I get the world coordinates of the child objects?