Answered

Root motion isn't working when I export as fbx only .anim

Caitlin 4 years ago updated by Peter - Soxware Developer 3 years ago 16

I'm not having any luck getting the root motion to come across when I export as FBX. The animation is just happening in place not moving the character around.

It works fine as .anim but I need FBXs.

please help :)

UMotion Version:
1.20p03
Unity Version:
2019.1.10f1

Answer

Answer
Answered

Hi Caitlin,
thank you very much for your support request.

Do you want to use your *.FBX animation as "generic" or as "humanoid"?

You need to tell Unity via the *.FBX import settings (shown in the Inspector when you have the *.FBX selected) how it should extract and generate root motion.

For generic, it's important that you define the "Root node" in the "Rig" tab and in the "Animation" tab under "Motion". For humanoid and generic, there are also the following settings shown under the "Animation" tab where it's important that "Bake Into Pose" is NOT ticked.

Also make sure that your character's Animator component has "Apply Root Motion" ticked.

Best regards,
Peter

Answer
Answered

Hi Caitlin,
thank you very much for your support request.

Do you want to use your *.FBX animation as "generic" or as "humanoid"?

You need to tell Unity via the *.FBX import settings (shown in the Inspector when you have the *.FBX selected) how it should extract and generate root motion.

For generic, it's important that you define the "Root node" in the "Rig" tab and in the "Animation" tab under "Motion". For humanoid and generic, there are also the following settings shown under the "Animation" tab where it's important that "Bake Into Pose" is NOT ticked.

Also make sure that your character's Animator component has "Apply Root Motion" ticked.

Best regards,
Peter

Rather than create a new issue I figured I'd piggyback off of this one.

I'm also having this issue, and I have checked all three things you mentioned:

- Root motion is checked in the animator

- Root node under Rig tab is defined as None as none of the other options are the root (I've tried them as well just in case and it still doesn't work)

- Root node under Animation/Motion tab is defined as <Root Node>

- "Bake into pose" and "Based Upon" doesn't show up

I get the warning "Animation curves for the root transform are not exported into the FBX file." upon export.

Hi Janooba,

the problem is that you have your root motion curves on the top most transform of your character. The warning message you get when exporting to *.FBX means that this is not supported. Instead, create your root motion by moving the transform below the top most transform. This is also the transform that needs to be selected as root node in the Inspector of your *.FBX.

Please let me know in case you have any follow-up questions.

Best regards,
Peter

Yeah that looks like it should work. Thank you!!

Hi, I also want to continue on this thread instead of making a new one. 

I have a similar problem, where when I export the animations as .anim clips the positioning of the character is correct. (in the clip settings I checked the Generate Root Motion Curves box too) When I export the Animations to the original FBX the positioning gets incorrect. It seems like when I go through the FBX import settings of each Animation and click "Based Upon Original" for the Root Transform Position(XZ) I can fix it. Now the thing is, I have around 800 Animationclips that I am trying to export. Is there a way to make sure the same settings from the Umotion project that are used for exporting to an Animation clip are being applied to the FBX export? Or is there a way in the FBX import to make all animations have a specific Root Transform Position setting?

Thank You!

Hi Laurenz,

thanks for reaching out.

UMotion does not touch those settings (it let's Unity choose the default values, just like if you would create the fbx in e.g. Maya and then import it into Unity).


If you can write code, you could write a "mass apply" script that sets the fbx settings for all your animations. You can create a wizard that uses the ModelImporter.clipAnimations to access every animation clip import setting. Don't forget to call SaveAndReimport() after you altered all the settings. In order to get the model importer instance, use the following code:

public GameObject character; // Displayed as input field by the wizard

void OnWizardCreate() // Called when the "create" button is pressed
{
   ModelImporter importer = (ModelImporter)AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(character));

   // todo modify your animation clips here

   importer.SaveAndReimport();
}

Please let me know in case you have any follow-up questions.

Best regards,

Peter

Okay, thank you for the tip with creating a Wizard for this. It worked great!

One thing that I wanted to say if anyone tries something similar in the future: I tried just changing parameters on "importer.defaultClipAnimations" directly but didn't have luck with that.

Instead of that I first set an array of Animation clips to the default animations:

ModelImporterClipAnimation[] anims = importer.defaultClipAnimations;

Then I change properties on the clips inside "anims".

After that I set the "defaultAnimations" to the Array I created first:

    importer.clipAnimations = anims;

and then do importer.SaveAndReimport();

This worked well for me, thank you again Soxware!

I actually noticed that the Animation events that I created in Umotion also didn't make it into the FBX. Do you happen to know anything about getting the Animationevents from Umotion into the Animationclips of the FBX? Sorry I know this is kind of on the border of what your software is supposed to be capable of but any help would be much appreciated.

Glad to hear that you got the wizard working! 


Animation events are expected to export correctly when exporting to FBX. I just double checked, in Unity 2017.4 and the events seem to export correctly for me:

Please double check (also verify if UMotion is up-to-date) and in case it is really not working for you, please create a dedicated bug report (ideally including all I need to reproduce your exact situation i.e. a UMotion project and a related character...). You can also send this directly to me via email in case you don't want your files to be publicly visible: https://www.soxware.com/email-support/ (please request a link to my Dropbox if file size is too big)

Thanks.

Best regards,

Peter

Okay after trying to export fresh from Umotion i saw that you are right, at first the events get imported to the FBX. It is after I run my Wizard and change settings like looping, mirrored and rootmotion that the animation events disappear. I will see what I can do to also keep those events and let you know what I come up with.

Done! So apparently this is like a thing in Unity that when adapting the animation import settings of an FBX through code and applying them, animation events don't carry over. (I would call this a bug but whatever)

If anyone ever runs into similar problems here, I found a solution that worked by users suggested in this thread: https://answers.unity.com/questions/618554/setting-modelimporters-clipanimations-clears-event.html

(Basically you save the animation events before doing your changes to the clips and then set the animation events again)

Danke Peter und Servus!

Great to hear that you've been able to solve this issue.

Ah ein Österreicher, Servus zurück :-)

Thank You for your quick reply! I will try it!

Hi, continuing this topic - what's the approach to completely remove root motion and have animation only for visual purpse?

I imported clip from mixamo, Humanoid, Root Motion Node set to "<none>", I baked all transforms: Y, XZ into pose, I disabled Apply Root Motion in the clip - I want all animations to be in place and serve no other purpose than visual.

Before editing in UMotion animation has some vertical movement, which is seen at runtime.

Now, when I import clip into UMotion I still see "RM" letters next to hips for some reason (I disabled it completely in the import settings, as said above) and when I edit hips position, let's say add more vertical motion by adjusting Y component and export, my animation is stripped from any vertical motion - it looks like there are only transformation along XZ.

Why this happening?

^ I think UMotion is messing something up - because once I checked exported anim clip it had all "bake" transform options unchecked. I checked them explicitly before importing into UMotion for editing. After export from Umotion and checking them again on the anim clip, it all worked well - all edits to the bones were preserved.

So @Peter - I don't know if this is intended or it's bug, it would be good to have your input on this.

Thanks,

S.

Now, when I import clip into UMotion I still see "RM" letters next to hips for some reason (I disabled it completely in the import settings, as said above)

In UMotion, the "RM" letters are always visible on the hips of a humanoid character. It only indicates that if you later enable root motion in the exported *.anim clip, the root motion curve is generated off of the hips bones.

^ I think UMotion is messing something up - because once I checked exported anim clip it had all "bake" transform options unchecked. I checked them explicitly before importing into UMotion for editing. After export from Umotion and checking them again on the anim clip, it all worked well - all edits to the bones were preserved.

When UMotion exports your animation, it creates a new *.anim file with default values for all the root motion settings. You then have to manually configure those settings to your needs. These settings are then kept when re-exporting your animation.

When you import an animation into UMotion, UMotion does not store the *.anim file settings. This is because it is not guaranteed, that you want the exported anim to use the same settings (what if you want to mix 2 or more *.anim files together into one, which settings should then be used?).

I hope this makes sense. Let me know in case you have any follow-up questions.

Best regards,

Peter