Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FBXLoader: Wrong transformation of child mesh. #22312

Open
avatar-studio opened this issue Aug 11, 2021 · 5 comments
Open

FBXLoader: Wrong transformation of child mesh. #22312

avatar-studio opened this issue Aug 11, 2021 · 5 comments

Comments

@avatar-studio
Copy link

Describe the bug

When loading some fbx files, the position of the second mesh is not correct.
In all programs except Three, the bow direction is normal.
However, in three, the direction of the rod of the bow is different.

To Reproduce

Steps to reproduce the behavior:

  1. Extract the attached zip file
  2. run index.html
  3. click 'load anim'

reduce code is below
001_fbx_load.zip

Code

// for load character
let loaded = await fbxLoad('./ArcherRi01.FBX');
loaded.traverse(child=>{if(child.isMesh) child.castShadow=true;});
loaded.getObjectByProperty("type","AmbientLight").removeFromParent();
loaded.getObjectByName("body").material.map = await textureLoad('./ArcherRi01.png');
loaded.getObjectByName("weapon").material.map = await textureLoad('./ArcherRi01_W.PNG');
scene.add(loaded);

// for anim
let animMixer = undefined;
let queue = false;
document.querySelector('[name=btn-load-anim]').addEventListener("click", async ()=>{
    if( queue ) return console.warning("already loaded animation");
    queue = true;
    let loadedAnim = await fbxLoad('[email protected]');
    animMixer = new THREE.AnimationMixer(loaded);
    let idleAction = animMixer.clipAction(loadedAnim.animations[0]);
    idleAction.play();
});

Live example

nothing

Expected behavior

Problems persist with animation

Screenshots

in other program
bug_1_other

in three.js
bug_1_three

Platform:

  • Device: [Desktop, Mobile]
  • OS: [Windows, MacOS, Linux, Android, iOS]
  • Browser: [Chrome, Firefox, Safari, Edge]
  • Three.js version: [dev, r???]
@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 12, 2021

I can reproduce. It works in Blender but not with the current FBXLoader. While testing with another website, I've realized that the model can be correctly loaded with older versions of three.js. It seems to work up to r96:

https://raw.githack.com/mrdoob/three.js/r96/editor/index.html

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 12, 2021

#14933 landed in r97. Maybe a side effect of this change...

@avatar-studio
Copy link
Author

Hello.
I tried loading the fbx file in r96.
well displayed.
Did you find the cause of the error?

@Mugen87
Copy link
Collaborator

Mugen87 commented Aug 12, 2021

No sorry, I'm not familiar with the details of FBXLoader.

@Mugen87 Mugen87 changed the title load error from fbx FBXLoader: Wrong transformation of child mesh. Aug 12, 2021
@DVLP
Copy link
Contributor

DVLP commented Aug 18, 2021

At some point I partially fixed rotation inheritance. Here's where I stopped leaving some clues behind #20932 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants