fix: update collider rotation to use Euler angles instead of raw quaternion values
This commit is contained in:
@@ -72,10 +72,12 @@ function ColliderInstance({ collider }: { collider: Collider }) {
|
|||||||
|
|
||||||
const pos = ref.current.translation();
|
const pos = ref.current.translation();
|
||||||
const rot = ref.current.rotation();
|
const rot = ref.current.rotation();
|
||||||
|
const q = new THREE.Quaternion(rot.x, rot.y, rot.z, rot.w);
|
||||||
|
const euler = new THREE.Euler().setFromQuaternion(q, 'XYZ');
|
||||||
|
|
||||||
updateCollider(draggedId, {
|
updateCollider(draggedId, {
|
||||||
position: [pos.x, pos.y, pos.z],
|
position: [pos.x, pos.y, pos.z],
|
||||||
rotation: [rot.x, rot.y, rot.z],
|
rotation: [euler.x, euler.y, euler.z],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user