How would I get the position of one gameobject relative to another (where the axis align)? Thanks!
Question too vague! Anyway, you can use something like this:
var obj1: GameObject; // drag the objects to these fields in the Inspector var obj2: GameObject; function Start(){ var relativePos = obj1.transform.position - obj2.transform.position; print("relative position: "+relativePos.ToString()); }
NOTE: When an object is childed to another, its transform.localPosition holds exactly the position relative to its parent in the parent’s local space: if the child is 1 unit ahead of the parent, for instance, its transform.localPosition will be (0,0,1), no matter which’s the parent rotation. In some cases it’s better to child the object to some parent and use its localPosition.