(* This section is for bug reports and feature requests only. This is NOT a help site. Do not ask help questions here. If you need help, please use stackoverflow. *)
I have edited the scene of the FBX loader to try to load model and animatuion from different FBX files. The same works in Unity and PlayCanvas, ie all animations are their own file, and can apply to several Models which are modelled the same.
Any when I play the animation the skinning is all wrong. As you can see here.
https://dl.dropboxusercontent.com/u/1722/three.js/examples/webgl_loader_fbx.html
This is the code I'm using to load the model, and the animation and then apply them to each other once both are loaded.
toon.zip
`
var loader = new THREE.FBXLoader( manager );
loader.load( 'models/fbx/toon.fbx', function( object ) {
model = object;
object.mixer = new THREE.AnimationMixer( object );
mixers.push( object.mixer );
if (animation !== undefined)
{
var action = model.mixer.clipAction( animation.animations[ 0 ] );
action.play();
}
model.scale.x = 0.1;
model.scale.y = 0.1;
model.scale.z = 0.1;
model.rotateX(-Math.PI / 2);
scene.add( object );
}, onProgress, onError );
loader.load( 'models/fbx/idle.fbx', function( object ) {
animation = object;
if (model !== undefined)
{
var action = model.mixer.clipAction( animation.animations[ 0 ] );
action.play();
}
}, onProgress, onError );
`
/ping @Kyle-Larson
I'll take a look at it when I get home. My gut feeling before looking at the file is probably because of Joint Orientations being applied, which aren't yet supported. I can confirm later today if that is the case.
I can confirm that there are Joint Orientations being applied, which causes PreRotation variables on the models. We unfortunately don't have support for PreRotation yet, but if you go into Maya and manually zero out the Joint Orient variables on each of the model nodes, that should hopefully remove the issue. If not, let me know and I'll try my best to resolve the issue.
These are models from a store, I do not have maya to be able to do this. There is also about 50 anims it would need to be done on.
Alright, then there's not much we can do short of getting PreRotation support into the FBX loader. This involves combining the Lcl Rotation of the node with the PreRotation for not only the creation of the skeleton, but also for all the keyframes of animation for that node. I can't guarantee that I personally will have time to make the fix, but on the offchance that I do, I will make the adjustment.
:-( sounds nasty.
I tried another couple of assets I have, and all seem to have the same issue when animations are separated from the model.