How to synchronize the transformation of objects of different hierarchy levels?

transform

#1

I have an object “A” in world space, and the parent of another object “B” is group. Now “B” object needs to move with the object “A” and the location are consistent.I use the following methods:

B.parent.updateMatrixWorld( true );
var localPos= B.parent.worldToLocal( A.position );
B.position.copy( localPos );

But the location is still inconsistent
or use getWorldPosition()If there are multiple levels, the returned world position is not correct


#2

Any chances to create a live example that shows what you are trying to achieve? In this way, it’s easier to provide feedback.


#3

I wrote a demo in https://jsfiddle.net/f2Lommf5/14194/
Please help!,thank you


#4

Are you looking for something like that?

https://jsfiddle.net/f2Lommf5/14239/


#5

Oh
thank you very much!


#6

sorry!:grinning: rotation and scale how to synchronize?


#7

https://jsfiddle.net/f2Lommf5/14354/

Read something like this, chapter “1.3 Invert transformations” in order to understand the code.