- Home /
Parent Child transformation inside editor
I have a probably rather trivial question. I want to do the following:
I want an object to move to a different position once it has a different parent(a simple empty transformation object).
What I do is the following:
Create Transform1(0,0,0)
Add Sphere(0,0,0) to Transform1)
Create Transform2(0,10,0)
Change parent of sphere to Transform2(Expectation would be position(0,0,0) but actually is (0, -10, 0))
I know how I could handle this via script but there must be for sure a way to do what I want inside the editor
hm if i get this right you want to have the sphere’s position at the same distance as it was in the first transform?
i just dont get what you want to do in the editor? is this for an editor extension? what’s the goal you want to achieve?
Basically, when I parent the sphere to Transform2, I want it to NOT have it's local position changed(in this case it changes its local position to 0, -10, 0 by adding the inverse transformation of the parent to compensate for the parent change which has position 0, 10, 0
This will not happen automatically. Changing a objects parent will keep the childs transform in world space as is.
To set the childs position to zero relative to its new parent you'll have to either type in the new transform values manually, move the child via the scene view or just click the gear icon in the upper right corner in the transform component of the childs transform and hit 'Reset'.
Your answer
![](https://koobas.hobune.stream/wayback/20220612193553im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Make a simple tree 1 Answer
Clone wants a Parent (c#)? 1 Answer
Rotate similar child objects around own origin 2 Answers
Getting variable data from Parent 1 Answer
How do I find a child object in a hierarchy of children? 1 Answer