Finding relative position

I have two meshes in my scene that are in different positions. I would like to parent one inside the other but then reposition it to a position to where it looks like the child mesh didnt move. Im sure BABYLON.Vector3.TransformCoordinates is involved in the solution but not exactly sure how.

like here: ( I have a box and a sphere. I want to parent the sphere with the box but of course the sphere will then be in a new world position since the position is relative to its parent. I would like the sphere to remain in the same world position. How can I do that?


looks like setParent does that for you, if i understand your question correctly …


Aw ha, I wrongly assumed that setParent does the same thing that setting the .parent prop would do. Thanks! :slight_smile:


No problem. Glad it worked out for you. To be honest i took a guess, but setting .parent peoperty will probably just set only the parenting itself and not change the positioning, so it will in effect change from being relativ to world position to parent position, and setParent method will do the repositioning aswell so to speak.