GetWorldPosition / GetWorldQuaternion not working.

Hi everyone,

I am trying to get the world position of my object, unfortunately every time I call getWorldPosition/getWorldQuaternion I always get the local position rather than the world position of this object.

let a = new THREE.Object3D();
a.position.set(100, 200, 300);
a.rotation.set(10, 20, 30);
scene.add(a);

let b = new THREE.Object3D();
b.position.set(12, 20, 30);
b.rotation.set(30, 60, 20);
a.add(b);

b.updateMatrixWorld();
console.log( b.position, b.getWorldPosition() ); // BOTH the value (12, 20, 30)
console.log( b.quaternion, b.getWorldQuaternion() ); // both the same value

Anything we can do to get to fix this issue ?

Thanks!

Author: Fantashit

1 thought on “GetWorldPosition / GetWorldQuaternion not working.

Comments are closed.