Babylon UnityExporter Animation State Problem(Looks like animation axes are flipped)

Hi, I’m using the latest the Babylon UnityExporter from github:UnityExporter/Redist at master · BabylonJS/UnityExporter · GitHub

I have a fbx file from my friend to test out. It has a model and a animation. It was perfect when I add it to the scene, without animation, but after adding a animation state, the animation looks twisted. my friend said it looked like the animation axes were flipped. I donno what to do, am I just use other method to convert the model, or did I missed some settings in UnityExporter?
more image and fbx download can visit here: Babylon UnityExporter Animation State Problem - Questions & Answers - HTML5 Game Devs Forum

Is this a skinned mesh… If so… Unity . only allows 4 max bone influencers. Sometimes when get this spaghetti looking model when you play a skeletal animation because the way the current version of toolkit encodes BONE influencers if there are MORE than 4 its goes crazy…

I made Maya Art Tools… it has a Reskin button that will allow you to reskin your model for 4 max bone influencers

Look at : Babylon Art Tools (Unity exporter) - Babylon.js Documentation

Thanks! I’ll try it!

As far as my friend said, the max bone influencers are exactly 4, and importing the fbx to maya is a mess,
and using the reskin tool I got either “No meshes selected for re-skining” or “Skin name is already in use: AIFBXASC233FBXASC177FBXASC1881Shape”. I’m basically a programming guy, 3d modeling software is just too much to learn in a short period of time, sorry.

Send me the model … I’ll check it out and see if it’s can get it going (181.5 KB)
be aware some Chinese characters :smile:

Well you got me… I can get this model to work. I can tell what the bones are like because its in Chinese. But i think the max bone influencers are 5 not 4… But your right when i try to reskin your model for 4 bones… gets and error about the SHAPE.

I even tried your model in my new Babylon Toolkit and its loads and plays the animation real funny like.

Dunno Bro… I dont think i can help you here with this model :frowning:

Maybe because it’s exported from 3DSMax. my team is trying to convert our Unity games to HTML5, and all the models are like this one, this is so sad… I’ll give the 3DsMax exporter another try.
But thanks anyway!

Yo @tinysnake … I got your model to work in my New Toolkit… WITHOUT RE-SKINNING.

But your bones structure has issues… I dont support TRANSFORMS as bones… If you have a bone hierarchy… They should ALL BE BONES (Joints) … As soon as it hits a TRANSFORM in the bone hierarchy… It stops there… and you WONT get the animations all the OTHER bones under the TRANSFORM…

Just make your skeleton… ALL BONES… NO TRANSFORMS in the bone hierarchy

Here is your bone hierarchy now (NOTE THE MIX OF TRANSFORMS AND JOINTS):

Clean those up and it should work in new toolkit… Working in the current toolkit REQUIRES the max bone influencers to be no more than 4… So you gotta RE-SKIN for that… I hope that helps :slight_smile:

ok… at least we found the problem!
I asked my friend why he would use transforms instead of bones, he said some times he just wants to manipulate 1 single point, instead of a bone, so he does these.
Anyway, If you can get transform animation working that will be perfect!

I use Unity to get the Mesh.BoneWeights… Then build GLTF JOINTS_0 and WEIGHTS_0 from
that. I cant really detect WHICH item in the bone hierarchy is a bone and which is a transform.

I just get an array of Bone Weights… I dont know how Unity internally handles these transforms to get them to work (Specially since the don’t actually have a WEIGHTS). But the toolkit just export the raw bone weights from this array… I notice along time ago in the first toolkit that if those are NOT REALLY bones… The Exporter wont have the proper weights to assign… I dont know if Unity just gives us ZEROS for those TRANSFORMS or what…

In short, You gotta clean up those models to work with my Toolkit. You always want MUCH CLEANER artwork for your WebGL game than what unity will let you get away with for a Native Unity Game. I have a Maya Art Tools video where i talk about make GOOD CLEAN OPTIMIZED game art WHENEVER you can. Just cause it runs in Unity DOES NOT mean it will run well in the Babylon WebGL environment.

That what the art tools do… lets you optimize your geometry… Combine Meshes, Create Texture Atlas Skins, Etc… And even Re-Skinning when for some reason your SKIN CLUSTER for your model is behaving funny… NOT just to set Max bone Influencers… I just put that little feature in my art tools so you can quickly re-skin your model (In Maya We Actually Create a New Clean Skin Cluster… That is the perfect time to specify max bone influencers… so i do).

Sorry… Your modeler is going to have to clean up the Bone hierarchy with all bones for those animations to work correctly when Exported From Unity using my Babylon Toolkit.

Regular transform animations work fine… That is animating the Translation, Rotation and Scale of the TRANSFORM (I Unity that is the GameObject itself…It can have a Mesh Filter Component… but does not have to).

Your problem is you have TRANSFORM (A Modeling package Transform) in the bone hierarchy… So unity/the toolkit thinks its a BONE and tries to sample the animation clip for that BONE at the the given Animation Clip Time… The problem is that bone is not really a bone.

A bit confusing… using TRANSFORM. In modeling package the TRANSFORM you are using in the bone hierarchy it NOT the same Unity GameObject.Transform… Which is what regular transform animations in Unity Do… move the Position, Rotation and Scale of the GameObject its self via its TRANSFORM. Skeletal Animations using the BONE hierarchy is a bit different… And again… at least in my exporter… needs to be BONES (JOINTS in Modeling Software).

Again Sorry… I don’t think i can do anything about that.

I agree your points, but Artists normally don’t like to manage the work structure you know…
At this time our team is focusing mainly focusing on just redo the programming, and leave the art work untouched, so there’s nothing I can do about that.
A Chinese game engine called layabox supports our models(but they don’t support animating blend shapes), donno how they did it.
I’ll take time to investigate this. and I’ll let you know if I made some progress.
Thank you again for explaining this to me. It’s a huge help!

No worries… Hope you get it worked out :slight_smile:

Hi dude, I found UnityGLTF works fine for me too, just to let you know…
But the toolkit’s workflow is better, if I use this tool to export model, why don’t I use the modeling tool to export to gltf from the first place. :smile:

Yeah it works… But very basic functionality by default. You gotta fix up the code to do good stuff:

For me … First and Foremost… I export unity metadata… the heart and soul of the Babylon Scene Manager Loader Plugins

Second… Each version only does a few things and they all do them differently like Export Accessors

Third… My has all the GLTF 2.0 features working great. Including

  • SaveGLB with texture packed in the internal binary streams… Not external like UnityGLTF with its basic binary support.

  • BlendShapes and BlendShape Animations

  • Transforms and Skeletal Baked Animations

  • Default Material Fallbacks including Custom Materials And Shaders With Custom Properties

And a few other little enhancements to the UnityGLTF core code

Anyways… I use GLTF as just another file format for my Babylon Toolkit … You can now export complete games with scripts and everything using either .babylon, .gltf or .glb scene files :slight_smile: