- Home /
How to position two objects together based on child location.
Ive come across a situation Im not totally sure how to solve with the Parent->Child system Unity uses. Say I have two objects
ObjectA (Mesh)
-->ChildBindpointA (Empty child just for having a transform to use as a bind point)
ObjectB (Mesh)
-->ChildBindPointB (Empty child just for having a transform to use as a bind point)
What I want todo. Is position the objects so that both ChildBindpointA and ChildBindpointB are in the same place.
I cant use the parent transforms of both objects as the bind points because the Pivot point of the model wont always be the bind location.
Answer by robertbu · Apr 04, 2014 at 06:44 PM
Moving ObjectA so that the child of A is at the position of child of B:
var offset = ChildBindPointB.position - ChildBindPointA.position;
ObjectA.transform.position += offset;
If 'ChildBindpoint' are game objects rather than transforms, you would need ChildBindPoint.transform.position.
Your answer

Follow this Question
Related Questions
Colorize heirarchy items? 0 Answers
Two objects in same space disappearing 1 Answer
Cannot position child object relative to parent. 3 Answers
Keep instantiated GameObject's position while parenting it to another GameObject 3 Answers
Object changes position/rotation, when moved (in/out of parent) in the heirarchy in the editor! 0 Answers