ColladaLoader horizontal vector

Viewed 25

I use blender and three.js to read the .dae file respectively, the blender shows parallel to the x and z axes, but three.js shows that it is tilted 90 degrees to the y axis.

Example file(1b03f03d-88a2-4c12-9c75-82539a48c081)

blender: enter image description here

three.js:

let loaderDae = new ColladaLoader();
loaderDae.load('assets/1b03f03d-88a2-4c12-9c75-82539a48c081/untitled.dae', (dae: any) => {
      this.model = dae.scene.children[0];
      this.model.position.multiplyScalar(0);
      this.scene.add(this.model);
    });

enter image description here enter image description here

I don't know if it's a problem with the vector in the original file, or with three.js reading it, should I modify the original file or adjust the vector through three.js?

How can I flip the model if it is through three.js?

1 Answers

this.model = dae.scene.children[0];

Since you are doing this, you skip a transformation of the root object that performs the up axis conversion. So just do this:

this.model = dae.scene;

In general, you should really consider the usage of Collada (as well as OBJ and FBX) since the more modern glTF is better in so many ways. At least when exporting a glTF asset from Blender, it will automatically care about proper up axis conversion.

Related