相关文章推荐

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.
Cheers

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;
https://global.discourse-cdn.com/business7/uploads/babylonjs/original/3X/b/6/b68269bdca2c46f05e84c56af06136ba24afd4d9.mp4

Now looks like this using GLTF;
https://global.discourse-cdn.com/business7/uploads/babylonjs/original/3X/b/f/bff13764acd5b93adf2d765013ca32e5d7578485.mp4

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

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.

https://global.discourse-cdn.com/business7/uploads/babylonjs/original/3X/e/6/e6e41d93cce6885168698b5a3afe76ec0fd0a6f0.mp4

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

“code”: “ANIMATION_CHANNEL_TARGET_NODE_SKIN”,
“message”: “Animated TRS properties will not affect a skinned mesh.”,
“severity”: 1,
“pointer”: “/animations/0/channels/222/target/path”
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 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:

 
推荐文章