GLTF 模型在 three.js 中旋转时变形

GLTF model deformed upon being rotated in three.js

我一直在尝试将一个 gltf 模型从 blender 导入到三个 js 中,但我在旋转它时遇到了问题,因为每当我尝试将其四元数设置为除 (0,0,0,1) 以外的任何值时,模型变形了。我提供了模型使用 (0,0,0,1) 四元数的截图,以及当我将四元数更改为 (0,1,0,1) 时的样子。

这是我导入模型的代码



loader.load('./resources/Machina_Colored.gltf',

  function(gltf){

    //pos and quat are a THREE.Vector3 and THREE.Quaternion respectively

    const mMass = 0;
    const size = new THREE.Vector3(4,8,4); //this is the size of the model in blender

    const mShape = new Ammo.btBoxShape(new Ammo.btVector3(size.x * 0.5, size.y * 0.5, size.z * 0.5));
    mShape.setMargin(0.05); 

    const mObj = gltf.scene.children[0]; 

    createRigidBody(mObj,mShape,mMass,pos,quat); //this seems to work with any quaternion it's just the model itself that is having problems

  },

  function(xhr){
    console.log(((xhr.loaded/xhr.total) * 100) + "% loaded");
  },

  function(error){
    console.log('An error occured');
  });

这是具有 (0,0,0,1) 四元数的模型(正常工作)

然后这是我使用 (0,1,0,1) 四元数时发生的情况

为了以防万一

,我还附上了我的文件在 blender 中的截图

感谢 WestLangley 的评论,我将这些代码行添加到程序的顶部

const eul = new THREE.Euler(0,0,0); //this now controls the rotation of the model

quat.setFromEuler(eul);

并且旋转反射不变形