- Home /
How do I disable keyframe interpolation on animations?
I have a 2d/3d-facial rig with different mouth poses applied to different polygons. In my animation I scale down and scale up joints at certain keyframes (to be able to hide and show these mouth poses).
In Maya everything looks OK. But when I import it into Unity it start to look different, as the animation tries to interpolate between keys, even if i turn compression off. How can i disable this type of smooth interpolation to be able to have the animation look snappy, with constant animation curve values?
Answer by david_is_neato · Feb 10, 2014 at 07:12 PM
If you select all of the keyframes you can right click one and select Both Tangents -> Constant
I'm not 100% sure that will work for your imported animation, but its working well for my keyframed positions with sprite animations
This works for me, 8 years later :)) just one thing, the last keyframe does not get played, at least for me, so I added a useless one to be the last.
Answer by lorenzofman2 · Dec 23, 2015 at 04:41 PM
If someone still with this question:
Select the wanted frames
Right Click
Select Flat (This will auto disable the option "AUTO" )
Don't mind for my english :)
I'm using Unity 5.2.0f3 however in my 4.1.2 version it's working too
Answer by laurentlavigne · Jan 14, 2018 at 10:18 AM
this shit is awful, here is the script to disable it, thanks to one of the devs
using UnityEditor;
using UnityEditorInternal;
using UnityEngine;
static class TreeViewUtils
{
[MenuItem("TreeViewUtility/Toggle Animation")]
static void ToggleAnimation()
{
const string prefKey = "TreeViewExpansionAnimation";
bool newValue = !EditorPrefs.GetBool(prefKey, true);
EditorPrefs.SetBool(prefKey, newValue);
InternalEditorUtility.RequestScriptReload();
Debug.Log("TreeView animation is now " + (newValue ? "enabled" : "disabled"));
}
}
Answer by Paulius-Liekis · Aug 03, 2013 at 09:36 PM
I don't think there is a setting for that. You would have to set time of these animations to specific frames from script yourself.
Answer by dansopanso · Jan 15, 2019 at 12:23 PM
Thanks for sharing this Script! The other tipps helped aswell. This is such an old post but still seems to be an issue.
Even if I use the script, uncheck "Resample Curves" and turn "Anim Compression" in the Import-Animationtab to "off", my Animation still looks different when I import it into Unity. It seems like Unity is just reading the Keyframes "wrong".
I'm working on a project with Unity 2018.1.1f1 and an FBX 7.4 binary from Blender. But strangely this doesn't occur in all of my animations and I wonder if this might be an issue of the fbx version, or unity or blender? But since I found people having the same problem with maya and 3ds max it seems like it is a problem in Unity.
EDIT: I finally figured out how to (almost) completely solve this in my case. Looks like the finals answer lies in Unity AND Blender.
When exporting the File as FBX 7.4 from Blender there is an export setting called "Simplify" and "Sampling Rate".
Set Simplify to 0.0 and Sampling Rate to 1.0When Importing into Unity go to the Animation Tab and set Anim. Compression to "Off"
The "Resample Curves" Checkbox doesn't make a difference no matter if checked or unchecked. Looks like there is a Keyframe for every single Frame now which seems a bit bonkers to me but at least the Animation looks like it's supposed to look. Eventhough it is a very small file the size doubled after this export change. Still not a 100% satisfying solution but it works.