Search Unity

Need help: Difference between Animation in Animation Window and Playmode

Discussion in 'Animation' started by MxShepherd, Apr 12, 2017.

  1. MxShepherd

    MxShepherd

    Joined:
    Feb 19, 2017
    Posts:
    9
    Hi everyone!

    I was trying to animate an object inside Unity using its Animation Tool . As you can see in the first picture it is a very simple animation manipulating the Rotation EulerAngles of an object around its X and Y axis. So in absolute values the X and Y rotation shall alternate between [ -5 ; 5 ] as shown in the first picture. When clicking on the tiny Play Button in the Animation Window everything looks fine.
    Bildschirmfoto 2017-04-12 um 15.28.02.png

    Now here comes my PROBLEM which is slowly freaking me out:

    When I trigger the Animation in Playmode in the Editor the object does not behave as it did in the Animation View. Instead of alternating between [ -5 ; 5 ] the X and Y rotation values are changing like in the second picture (note that I have shifted the yellow curve by myself for demonstrating the issue).
    The X values are alternating correctly, but in Playmode it seems that the changes of the values are applied individually with reference to the value 0. In this case the Y value changes over a half period from 5 to -5 which makes a difference of 10 (obviously). This now results in the behaviour which is shown in the second picture. So in Playmode the X value alternates correctly between [-5 ; 5 ] but the Y value constantly alternates between [ 0 ; -10 ] !!!
    Bildschirmfoto 2017-04-12 um 15.28.46.png
    It seems, that the animation is not setting absolute values to the Transform of the animated object but only applies the changes represented by the animation. It's weird, because the animation itself is shown correctly in its preview...

    I have already tried turning on and off "Apply Root Motion" and "Write defaults", but nothing changes.

    Please help me,

    cheers
    Max.
     

    Attached Files:

  2. MxShepherd

    MxShepherd

    Joined:
    Feb 19, 2017
    Posts:
    9
    Ok, 3 hours later I found the solution:

    The Blending mode of the Animator Layer was set to "Additive" which explains the described behaviour. To set exactly the values you determine in your animation curves you have to set it to "Override".
    Bildschirmfoto 2017-04-12 um 17.54.04.png
     
unityunity