[solved] Unity to babylon?

Hey all,
Does anyone know of a unity to .babylon file exporter?
Been looking around, (trying to avoid GLTF/GLB), but so far no success.

I couldn’t find the old one (pre toolkit) and i’d guess it doesn’t work with newer unity versions either way…
Tried the unity toolkit, but only seemed to export to GLTF and no animations from my quick test. :thinking:

all i want is to select a mesh, click a button, get a .babylon & textures, the world is become way too complex :wink:

So i’m stuck with unityGLTF plugin from the official KhronosGroup github, but this is not perfect either.

cc @MackeyK24, I think the Unity toolkit does support animations(?)

Maybe it’s just my setup it doesn’t support :thinking: Unity have so many options.
either way, the UnityGLTF plugin exports the animations and models ok.

The problem “but this is not perfect either” turned out to be the GLTF spec itself, doesn’t support TRS animations on the root nodes bone (for some reason…)

So an animation that looks like this in Unity;

Now looks like this using GLTF;

Leaving two choices, the good old.babylon file format or reskin some 50 meshes (Separate Male/Female human models & armor/clothes) & find a whole new range of animations without TRS

1 Like

@MackeyK24 would be the guy to ask.

I think he is working on supporting root motion.

I typed wrong in my previous post, (ment to be root Bone, not Node).
It’s not root motion, but a normal TRS (position, rotationQuaternion & scale in BJS terms) animation targeting the root bone’s position compared to it’s parent.

According to the GLTF spec, this is not to be supported by the spec & validator even throws a warning about it.

Skeleton is Humanoid with the following layout

Armature // Ground position

Root_M // skeleton root, located slightly above the hip, as seen in the first video.

Hip_L // builds bones down left leg
Hip_R // builds bones down right leg
Spine1_M // builds bones up torso, head, arms, etc

After spending some hours tinkering around,
I found the best solution was to simply copy the keyframe values from unity and put them in a babylon animation, and then add it to the respective animationGroup with root_m target as intended.
Why the GLTF spec thought this shouldn’t be “allowed” still baffles me.

1 Like

Should not have to all that stuff to work around the issue.

Can you please send me the original character and animation for use in a Unity and I will try to export from Unity toolkit to gltf for Babylon with its animation

1 Like

Hi @MackeyK24
It’s a paid asset,
but there’s a free version that should have the same result; FREE - Modular Character - Fantasy RPG Human Male | Characters | Unity Asset Store
just add an animation that have TRS on bones, i used the “death” animation from animations/combat folder because it’s so clearly visible.

But it’s the GLTF spec that doesn’t want to support it, warning message from validator

“message”: “Animated TRS properties will not affect a skinned mesh.”,
“severity”: 1,
“pointer”: “/animations/0/channels/222/target/path”

If you can point to the specific part in the spec, I can probably explain it.

I think this might help?

Hi @bghgary
Thanks for looking into it.

Unfortunately i won’t be near a pc until tomorrow.
I only have the validator warning msg right here and now.

The more i’m thinking about this, the more convinced i’m becoming that this must be some kind of misunderstanding between the spec and the developers of the validator & aswell as the exporter i’m using.

Not having TRS animation on a “skinned node” aka a skinned mesh makes perfect sense,
but the animation targets a bone which should be ok (it’s called root_m, but it’s a bone, and child of the actual skeleton root)

Funny side-note is that the exporter exports the RotationQuaternion animation targeting root_m just fine, this is what flips the model in the “death” animation from standing up to lying down, so it works in babylon, and it’s also what triggers the warning from validator :sweat_smile:

I’m part of the glTF working group and I worked on this part of the spec. I’m sure we can sort this out. Let me know if there are specific things we can investigate.

1 Like

I circled back to the great Unity Toolkit and now managed to get the animations exported & it’s working!

Thank you all for trying to help & trying to understand my posts of confusion :smiley: