Hi,
AMesh’s position=[1, 1, 1],rotation=[Math.PI / 3, 0, 0] ,group’s position=[2, 2, 2],rotation=[Math.PI / 4, 0, 0] ,I put the AMesh in the Group. How to calculate the position and rotation after placement so that the position and rotation are consistent.
Here is link
Local transforms within (direct) parent - Object3D.position / Object3D.rotation / Object3D.scale / Object3D.quaternion
World transforms regardless of parent hierarchy - Object3D.getWorldPosition / Object3D.getWorldRotation / Object3D.getWorldScale / Object3D.getWorldQuaternion
Hi mjurczyk,
here is my link ,Stage presets, gltfjsx (forked) - CodeSandbox
I calculate it’s position and rotation, but it cannot be aligned with the coordinates of amesh.
Can’t see a point of using that second group in this case tho
I need to move to the second group, I need to do an animation, so I need to calculate the coordinates after the movement to be visually consistent
@donmccurdy I found this related question, but I see how to convert this world coordinates to local coordinates, also including his rotation information conversion, but I still don’t know how to do a conversion, can you help me
I find a way to relove.
GMesh.updateMatrixWorld();
const obj = new THREE.Object3D();
obj.position.set(AMesh.position.x, AMesh.position.y, AMesh.position.z);
obj.rotation.set(AMesh.rotation.x, AMesh.rotation.y, AMesh.rotation.z);
obj.applyMatrix4(GMesh.matrixWorld.invert());
const BMeshPosition = obj.position;
const BMeshQuaternion = obj.quaternion;