0
\$\begingroup\$

How can I prevent the following animation frames from affecting the state of the previous animation frames in Unity?

E.g. I create a frame at 0:20 by moving a character leg. And that is it - that is what I would like my character to look like at the 0:20 and I would like to change nothing more about the current positioning of my character parts and never.

But, here I proceed to the 0:40 and move another part of my character - foot this time. And now instead of starting to move after the 0:20 the foot starts to move from the 0:00.

That drives me crazy, because now I have to go through all of the frames before the 0:40 and modify the foot position. Of course in the presented case there is only one frame to update - that is the 0:20. But when I work with complex and long animations I easily stumble across having to update 10 or even more of the previous frames each time I decide to move a part which I did not move in the previous frames.

I noticed the Add keyframe button in the Animation window. I would expect it to preserve all the character parts in frame and solve my issue. But it does not prevent the case explained above from happening.

Another thing I was thinking about is to develop animations backwards - starting from the last frame and proceed to the first frame. But that feels like a lame user experience from a Unity user point of view.

Any help here would be appreciated.

enter image description here

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

The reason this happens is that you didn't tell Unity where you wanted the animation to start, because you had no keyframes on the foot position property until the one you created at 0:40. So Unity assumes you want the movement to start at the start of the animation.

Keyframes are handled independently for each property, so having a keyframe on a different object property does not count as a keyframe for the foot.

You can add a property for the foot position by clicking the Add Property button, then create a keyframe on that property at the time you want the motion to start. Or you can use this trick to create the keyframe you need automatically:

  1. Place the play head at the time when you want the motion to start (ie. 0:20 in this example)

  2. Hold CTRL to enable snapping, and move your object one snapping tick over, then back to where it was, without letting go in between. (The snapping helps you get back exactly to where you were, without error)

    This automatically adds a property for this object's position to the animation, and creates a keyframe at the current play head position. So now you have a keyframe for the start of your motion.

  3. Now move the play head to the time you want the motion to finish (ie. 0:40), and move the object as you were trying to do before.

    Because you've already created a keyframe for the start of the motion, the motion starts from that keyframe, rather than from the start of the animation at 0:00.

\$\endgroup\$
6
  • \$\begingroup\$ I am not getting the part with the CTRL usage. In my case pressing it while moving the character parts around does completely nothing. Also, it is not clear what it means to move an object one tick over. \$\endgroup\$
    – some1 here
    Mar 21, 2021 at 12:53
  • \$\begingroup\$ What tool do you have selected in the toolbar at the top of the editor window? \$\endgroup\$
    – DMGregory
    Mar 21, 2021 at 12:55
  • \$\begingroup\$ Ok. It seems I have figured it out. I had to select the Move Tool, while I was trying to do the CTRL trick using the rigging bones. But it feels really hard to add key frames this way due to a jumping of the character parts back and forth. So, it seems the easiest way is to right click the transform and select to add all animated properties or just create an editor script which would add key frames for all of the parts I need automatically. \$\endgroup\$
    – some1 here
    Mar 21, 2021 at 12:59
  • \$\begingroup\$ Btw, Unity does what I want to be done by default for the first animation segment. I.e. it adds the keyframes I need to the 0:00 time. Why would not they make the same for other animation segments. I guess it definitely can be automated. I will maybe post a different question for that later. \$\endgroup\$
    – some1 here
    Mar 21, 2021 at 13:03
  • \$\begingroup\$ Adding the keyframe to the 0:00 time is exactly what it's doing for the foot, and exactly what you're complaining about. To Unity, the leg move and the foot move look identical — both get an auto-created keyframe for the start of the motion at 0:00 because they had no previous keyframe to start from. In the leg's case, that was exactly what you wanted. In the foot's case, it wasn't, but Unity cannot know that without reading your mind, because you didn't do anything to signal to it that you wanted the start keyframe to be somewhere other than 0:00. \$\endgroup\$
    – DMGregory
    Mar 21, 2021 at 13:05
1
\$\begingroup\$

This is caused by the Animation window's automatic easing curves. At the bottom of the animation window there are two tabs, "Dopesheet" and "Curves". In the "Curves" tab you can view or edit the smoothing/easing curves. Switch from bezier to linear if you don't want this type of side effect to occur when you edit a keyframe.

  1. Right-click a point on the curve
  2. Select Left Tangent > Linear
  3. Repeat for Right Tangent
\$\endgroup\$
4
  • \$\begingroup\$ What do you mean by switch? When I go to the Curves tab I see a few curves and it is not clear what should I do. Should I edit the curves manually? In case I should, then your answer proposes a more complicated solution. Because it is easier to update all the previous frames than to update a curve on different intervals. \$\endgroup\$
    – some1 here
    Mar 20, 2021 at 17:28
  • \$\begingroup\$ Also, I assume you meant Constant and not Linear, because Linear is not different from what is created by default in terms of my issue. \$\endgroup\$
    – some1 here
    Mar 20, 2021 at 17:32
  • \$\begingroup\$ @some1here I've updated the answer, but it's also good to get used to looking at the documentation when you aren't sure how to use a feature. \$\endgroup\$
    – Kevin
    Mar 22, 2021 at 18:04
  • \$\begingroup\$ Ah, I see from DMGregory's answer that I didn't notice you were missing a keyframe and approached the question from the wrong direction. It's still good to be aware of the Curves because they can cause unexpected side-effects when you edit keyframes. \$\endgroup\$
    – Kevin
    Mar 22, 2021 at 18:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .