alibaba
September 14, 2018, 8:03am
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
Mugen87
September 15, 2018, 9:08am
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.
alibaba
September 18, 2018, 1:24am
3
Mugen87:
live example
I wrote a demo in Edit fiddle - JSFiddle - Code Playground
Please help!,thank you
Mugen87
September 18, 2018, 8:33am
4
Are you looking for something like that?
https://jsfiddle.net/f2Lommf5/14239/
alibaba
September 19, 2018, 3:15am
6
sorry! rotation and scale how to synchronize?
Mugen87
September 19, 2018, 8:53am
7
https://jsfiddle.net/f2Lommf5/14354/
Read something like this , chapter “1.3 Invert transformations” in order to understand the code.