Fixed

Error on Export

felix 2 weeks ago updated 1 week ago 10

Hi,

I am trying to create an animation using only "constant" interpolation between keys, however when I export the animation it doesn't stay constant in the resulting animation clip, and I am getting two errors in the console on export:


QuaternionToEuler: Input quaternion was not normalized
UnityEditor.AnimationUtility:SetEditorCurve (UnityEngine.AnimationClip,UnityEditor.EditorCurveBinding,UnityEngine.AnimationCurve)

Assertion failed on expression: 'IsFinite(rot)'
UnityEditor.AnimationUtility:SetEditorCurve (UnityEngine.AnimationClip,UnityEditor.EditorCurveBinding,UnityEngine.AnimationCurve)

The rig and umotion project are "generic".

Any help with this? I tried deleting+updating umotion already. And I am confused, since I have never run into this issue when exporting previously - I don't know that I have changed nothing with the .fbx, and the version of unity is the same as before...

I am using Unity version 2020.21f1, Umotion version 1.26p05.


Best regards,

Felix Wahlström

UMotion Version:
1.26p05
Unity Version:
2020.21f1

It looks like the errors only appear when exporting an animation that uses constant interpolation between keys. The ones that don't (only linear, auto etc) are fine

Under review

Hi felix,
thank you very much for your bug report.

I tried reproducing this issue but it doesn't seem to happen for me using a generic version of robot kyle (from the UMotion examples folder). Might be something specific to your character/animation. May I ask you to export your character (without textures if you want) together with the related UMotion project as *.unitypackage so that I can reproduce your issue? It's important to export as *.unitypackage as that ensures to include all import settings.

You can send me the files via the email support form (or if file size is too big, you can request a link to my dropbox).

PS: What Unity version are you using exactly? Unity 2020.21f1 does not exist, do you mean 2020.2.1f1?

Thank you very much and I'm sorry for the inconvenience.

Best regards,
Peter

Thanks for your reply! I sent you the .unitypackage using the form.

And yes I am using 2.1f1, that was a typo :)

Hoping we can get to the bottom of this

forgot to sign in!

Hi Felix,

thank you very much for sending me the requested files.

The export is working correctly for me:

I'm not getting any error messages, and the exported animation plays correctly (constant interpolation). I'm sending you the exported *.anim file via email.

I used Unity 2021.2.2f1 for my test and UMotion V1.26p05. Please double check that your UMotion version really is V1.26p05 (click on Help --> About UMotion in the clip editor to see the current version). Maybe also try updating your Unity version to 2021.2.2f1?


Best regards,
Peter

Working on fix

I can see the constant interpolation not being exported correctly now, sorry for the confusion. Though I'm not getting any error/warning messages.

I'm looking into this.

Best regards,
Peter

Thanks Peter no worries, let me know if I can do anything else to help test it!

Fixed

Hi Felix,
I've sent you an email with a patch release that is addressing your issue.

Update: Fixed in UMotion V1.26p07.

Some background:

The constraint system (namely the IK and the child-of constraints) requires re-sampling of the animation curve. That means that the curve that is exported into the *.anim file is generated by executing the constraints at each frame of the animation clip. Now the curve contains animation keys at each frame, and is then optimized by removing any redundant keys. All curves saved this way are using linear interpolation between each frame, as this gives best results in regular use-cases.

In your situation, there where animated properties that had an IK or a child-of constraints setup, but where not actively using them. There was a bug that even in this scenarios, the animation curve was re-sampled. Thus instead of your authored FK curves with the constant interpolation, the resampled curves with the linear interpolation where used. This is fixed now.

But when you are actively using the child-of constraint or the IK constraint, please be aware of that the resampling has to be done in this case and that constant interpolation will only work on a frame by frame basis, but not between two frames. This is a feature UMotion's constraint system is currently not capable of doing. This would be rather complex (even impossible in some corner cases) to implement, so is currently not planned.

If you discover such situations in some of your clips, you would have to either not use a constraint in this case or adjust the tangent mode of the exported animation clip using Unity's animation window.

Another (in my opinion better) solution would be to solve this via code by only sampling round frame times from your animation clip (instead of letting the animation system interpolate between key frames). I.e. manually advance the playback time in such a way, that it always rounds down to an integer frame. This would make any animation that you play via this way, as if it was using constant interpolation.

Please let me know if the update works for you, so that I can upload it to the asset store.

Thank you very much.

Best regards,
Peter

This is the workaround we discussed per email that should work in every case (I'm adding it to this forum thread for completeness):


  1. Select all animated properties in the clip editor (select the first, scroll down to the end, hold shift and click on the last one).
  2. Click on the gear icon of any rotation animated property, and select "Rotation Mode --> Euler Interpolation".
  3. Export your animation.
  4. Now open it in Unity's animation window, select all keys and change the tangent mode to constant.

Best regards,

Peter

Nice, and thanks for the support!