Search Unity

Rotation animation issue with constant tangents?

Discussion in 'Animation' started by ammar26, Nov 28, 2013.

  1. ammar26

    ammar26

    Joined:
    Jun 5, 2011
    Posts:
    29
    I'm creating an animation based on Transform -> Rotation in Animation window. But I don't want continuous animation curves, so I made the tangents for both sides constant like shown in picture

    $Curves.png

    But the animation is not discrete, its still continuos rotation animation. I don't want continuous motion. I want discrete values. Can anyone tell me whats wrong here ? Is it bug in unity or Im doing something wrong

    Can anyone please confirm? Is it a Bug?
     
    Last edited: Jan 20, 2014
  2. ammar26

    ammar26

    Joined:
    Jun 5, 2011
    Posts:
    29
    Can anyone please confirm me, is it a bug or I'm doing something wrong
     
  3. ammar26

    ammar26

    Joined:
    Jun 5, 2011
    Posts:
    29
    Please can anyone confirm ?
     
  4. Malhavok

    Malhavok

    Joined:
    Jul 23, 2012
    Posts:
    4
    Warning: i don't know how to achieve your desired behaviour in a nice way via Unity

    I'd say it's a bug. Why? Because, inside animation, rotation is handled differently than position and scale.
    When you look deep enough into animations, positions and scales are kept in key-frames (just like we place them), but whenever you add rotation it's interpolated for every frame.

    What i'd suggest as a test:
    1) go to edit -> project settings -> editor -> asset serialization, set to "force text" (this can take a while)
    2) open your animation in your text editor of choice
    3) seek string: "m_RotationCurves"

    you should see a long list of values under it, each starting with m_Curve. you're modifying euler angles and values there are quaternions, but let's not worry about it too much. Try removing all frames "in between" of your desired rotations (you seems to have some set time steps between certain rotation values).
    check if it works (i wonder that myself).

    Edit:
    i'd forgot. whenever you see "inSlope" and "outSlope" parameters in that curve, change their values to "Infinity" (capital letter at start). it should make change from one angle to another instant.
    EoEdit

    you can also search for "m_EditorCurves" and check whether these contain anything bad or are exactly the curves that you set via Unity interface

    after entire process you may want to turn asset serialization on. remember also to copy your animation before doing anything to it.

    Edit (my stupid mistake with quaternions...):
    quick quaternion guide: if you modified only euler z rotation, all of these angles should look like: (0, 0, sin(angle / 2), cos(angle / 2))
    EoEdit
     
    Last edited: Jan 5, 2014
    Makaveliy, hertz-rat and nicholasmu like this.
  5. Murfbard

    Murfbard

    Joined:
    Jan 11, 2014
    Posts:
    7
    I am running into this same issue. I am swapping sprites and unfortunately the rotation must be set immediately and not animate. I hope this is fixed soon.
     
  6. ammar26

    ammar26

    Joined:
    Jun 5, 2011
    Posts:
    29
    Thank you very much
     
  7. Elkis

    Elkis

    Joined:
    Jun 15, 2013
    Posts:
    87
    Thank you Malhavok! I ran into this issue too and your suggestion corrected it :D

    I hope this will get fixed soon.
     
  8. gnumaru

    gnumaru

    Joined:
    Dec 26, 2013
    Posts:
    20
    I'm not a necromancer, but let me raise the dead for a good reason.

    Even now, 2015, using Unity 5, this behavior remains the same, the bug is not fixed. Animation curves for transform rotations can't be set to constant and the curve can't be broken. The editor will show the graphic of a constant curve as expected, but it will play like an auto-curve.

    This behaviour should be fixed after almost more than a year...
     
  9. Bezzy

    Bezzy

    Joined:
    Apr 1, 2009
    Posts:
    75
  10. soulburner

    soulburner

    Joined:
    Mar 25, 2012
    Posts:
    169
    Just faced the same issue. That's a crap!
     
  11. Fexman

    Fexman

    Joined:
    Jun 17, 2015
    Posts:
    5
    Same issue for me, shouldn't this be an easy fix on dev side? Anyone report a bug yet?
     
  12. Fexman

    Fexman

    Joined:
    Jun 17, 2015
    Posts:
    5
    I just submitted an issue, waiting for approval.

    EDIT: Just realized Bezzy did a report, oh well.
     
    Last edited: Jun 17, 2015
  13. Sabrino

    Sabrino

    Joined:
    Aug 8, 2015
    Posts:
    35
    So this issue is still not fixed? It's been quite a long time, and it does seem quite straightforward. It is a very disruptive problem, especially for sprite work.

    Should we submit another issue? I couldn't find anything related to this problem on the bug tracker.
     
  14. weitay

    weitay

    Joined:
    Aug 5, 2012
    Posts:
    10
    Eurgh not again
     
  15. Fexman

    Fexman

    Joined:
    Jun 17, 2015
    Posts:
    5
  16. Sabrino

    Sabrino

    Joined:
    Aug 8, 2015
    Posts:
    35
    Thanks Fexman, let's hope it's fixed in the next version. In the meantime I'll keep animating an exposed public field to force the correct rotation...
     
  17. Fexman

    Fexman

    Joined:
    Jun 17, 2015
    Posts:
    5
    Tried it again with Version 5.2.2f1, not seeing any improvement.
    Been a while.
     
  18. Joseph_

    Joseph_

    Joined:
    Nov 28, 2015
    Posts:
    7
    I am experiencing this issue as well.
     
  19. Razouille

    Razouille

    Joined:
    Jan 25, 2013
    Posts:
    44
    Still got this issue with version 5.3.1p3... Is there any way to avoid that easily ?

    Editing the motion files is working, but i got hundred of them with many key points, i can't waste so much time with that...
     
    Last edited: Feb 9, 2016
  20. ggulsoft2

    ggulsoft2

    Joined:
    Jun 21, 2017
    Posts:
    1
    Genies_Dom likes this.
  21. nicholasmu

    nicholasmu

    Unity Technologies

    Joined:
    Feb 27, 2017
    Posts:
    9
    Good idea, I made a tool to change value to "Infinity"
    https://github.com/unity-cn/CustomAnimationTools


     
    BrightBit likes this.
  22. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    238
  23. v2-Ton-Studios

    v2-Ton-Studios

    Joined:
    Jul 18, 2012
    Posts:
    238
  24. nicholasmu

    nicholasmu

    Unity Technologies

    Joined:
    Feb 27, 2017
    Posts:
    9
    Can you provide some more information? error log, and unity version.
     
  25. AndrewRHBoyd

    AndrewRHBoyd

    Joined:
    Jun 8, 2017
    Posts:
    1
    Unity 2017.30f3 Personal (64bit)
    Error Log: "You are trying to import an asset which contains a global game manager. This is not allowed."

    This tool would be extremely useful. Please let me know if you update the tool or if you have an idea on how I could fix this myself. Thanks!
     
  26. nicholasmu

    nicholasmu

    Unity Technologies

    Joined:
    Feb 27, 2017
    Posts:
    9
    Hi AndrewRHboyd, I tested with Unity 2017.3.0f3, but unreproducible on my side, could you please give me small demo?

     
  27. Zklegon

    Zklegon

    Joined:
    Aug 24, 2018
    Posts:
    13
    Hey everybody, I'm currently using Unity 2018.2.15f1 and I'm running into the same issue with rotation interpolation still occurring despite the frames being constant. The fixes here didn't end up working for me. I'm going to be editing those frames out in some video software later on but I wanted to bring this up because it's still an issue that I think would be good to have fixed/improved on, thanks!
     
    Hollow_Spy likes this.
  28. raulius

    raulius

    Joined:
    May 9, 2017
    Posts:
    1
  29. nicholasmu

    nicholasmu

    Unity Technologies

    Joined:
    Feb 27, 2017
    Posts:
    9
    Hi Zklegon, I updated this tool, it support FBX file. Please try again. https://github.com/unity-cn/CustomAnimationTools
     
    Hollow_Spy, Syganek and playBlaster like this.
  30. nicholasmu

    nicholasmu

    Unity Technologies

    Joined:
    Feb 27, 2017
    Posts:
    9
    Hi Raulius, could you upload an animation clip? I'll test this.

     
  31. playBlaster

    playBlaster

    Joined:
    Jan 5, 2017
    Posts:
    7
    Hi Nicholasmu. I tried out your modified script today and I can confirm that it removed all curves from my stepped animation exported with maya. This is evident in the animation itself, however in the animation editor, there still appear to be curves. I'm choosing to not trust what I see there. the size of the anim file ended up at 3MB, rather large compared to the 527 KB file it was generated from. I exported the animation using the 2014/2015 fbx exporter version and I am using unity 2019.2.
     
  32. hexen888

    hexen888

    Joined:
    Dec 16, 2017
    Posts:
    1
    I managed to get around a similar issue by adding the properties manually to each key frame instead of using the record button. This is a good fix for simple animations but not so much for more complex animations.
     
  33. Syganek

    Syganek

    Joined:
    Sep 11, 2013
    Posts:
    85
    ribbanya likes this.