Change children's position after Group's position was changed

Hello.

Have got little question. I have got Group or Object3D with children. I want to change position of it, e.g.:
target.position.set(10, 10, 10);
It works, but children’s position stays (0, 0, 0). And after that i try to merge two objects, but it works incorrectly, beacuse children’s position stays (0, 0, 0) and two objects moved to this point, but they must to be in position(10, 10, 10) and e.g. (20, 20, 20).

Thanks in advance for your reply and sorry for my English, and sorry if i duplicated some topic :slight_smile:

Object3D.position represents the position of a 3D object in local space. So the position relative to its parent. If the 3D object does not have a parent, Object3D.position represents world space too.

In order to get the world position of child objects, use Object3D.getWorldPosition().

1 Like

Thanks for the answer!

But i fixed object’s merge by another way. I just change position of parent, and then, when i merge, i don’t use child’s matrix, i use matrixWorld and all work good.

If you return objects from group to the scene you should use attach method “scene.attach(object)” and it keeps position and will not go to (0, 0, 0)
https://threejs.org/docs/index.html#api/en/core/Object3D.attach

Great thanks.