- Home /
How do I overlay (blend) my own procedural animation on top of a canned animation?
Hello,
In Unity, I can play an animation composed in Maya, and I can also translate/rotate individual joints procedurally. But I cannot find a way to do both at the same time. How do I blend my own procedural changes (on top) of an already-playing animation?
It seems that when an animation plays, it overwrites any of my direct realtime changes to the transform. The two seem to be mutually exclusive.
I hope this question makes sense. Does anyone have any suggestions?
Thanks!
-jeffrey
Answer by fherbst · Jul 20, 2010 at 11:19 AM
You can do your changes in LateUpdate() to make sure you override the animation. And you will have to set your transform changes absolute to the original animation, not relative. This means:
function LateUpdate()
{
transform.Rotate(Vector3.up, 10);
}
will make your transform stay at a rotation of 10 (because before each LateUpdate the underlaying animation overrides your transform change from the previous frame).
Answer by MaDDoX · Jul 20, 2010 at 02:10 PM
Most important thing to know here is that you can tweak your "canned" animations and link them together using Unity's built-in animation editor. There's just a little trick to be able to do it, since imported animations show as read-only, you need to duplicate them in your project. The dup'ed animation will be fully editable and you'll be able to assign animation events to any specific point in your timeline.
That's the most important thing I wish someone had told me before, it'd have made my life soooo much easier. TBH it's kinda lame that such an important feature in unity is hidden and requires a "trick" as a guy from Unity says here (nice tut video, check it out):
Nice trick, pity it's only mentioned here. This is going to save me a lot of hassle.