Object quternion issue while exporting,

Hello, I’m trying to export the objects details from threejs and position models based on the data of the threejs scene, the object position is working fine, But I’m having issue with the rotation/quaternion.

this is threejs code,

 camera_rotation: camera.getWorldQuaternion(new THREE.Quaternion()),

on blender python code

    camera.rotation_mode = 'QUATERNION'  # Set the rotation mode to 'QUATERNION'
    camera.rotation_quaternion = (
        camera_rotation['_w'],
        camera_rotation['_x'],
        camera_rotation['_y'],
        camera_rotation['_z']
    )

thanks for the help.

  1. Default quaternion stringification order should be XYZW if I recall correctly.
  2. What exactly is the problem though?
1 Like

Yup. I’ve hit this before too… I think blender defaults to w as the first element instead of the last. I think I also ended up having to negate the W or something too… I remember there was some quirk…

There’s also the larger issue of Blender using Z as up… and all the exporters for threejs convert to Y up, so there might be some additional fixup required on the threejs side if OP is exporting the raw quaternion.