Jump to content

GLTFloader rotation with multiple nodes


Recommended Posts

I've been having problems loading GLTF files that load correctly using other graphics packages. I have GLTF files that contain multiple nodes and the nodes would end up rotated oddly.

Looking at the code, there is one place where, if the rotation is specified with a quaterion (rather than a matrix) the node rotation is computed with an odd RotationFromAxis computation. If I change the code to just fetch the quaterian from array, the GLTF file loads correctly.

The lines in question is 2195 in babylong.glTFFileLoader.js:

configureNode(lastNode, BABYLON.Vector3.FromArray(translation), BABYLON.Quaternion.RotationAxis(BABYLON.Vector3.FromArray(rotation).normalize(), rotation[3]), BABYLON.Vector3.FromArray(scale));

works if it is changed to:

configureNode(lastNode, BABYLON.Vector3.FromArray(translation),

Does one of the GLTF loader people know why the code is the way it is, and, is this a bug?

(Also, since I'm new here, should this be reported in the GitHub issues or is this the right place?)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...