Home Technical Talk

3D Animation: Resetting rotation after a 360 turn?

I'm a newbie when it comes to the technical aspects of 3D animation so I was wondering how to pull it off that a character makes some kind of backflip or turns around and the rotation values are shooting up somewhere into the 360+ area. Is it supposed to be like that? Is there some smart secret workflow trick that resets all the values back?
I'm especially asking because I believe that these 360+ values can become problematic in game engines when transitioning back to other idle animations or some sort.

Side Note: I've only been working with Autodesk Maya so far!


  • Hito
    Offline / Send Message
    Hito interpolator
    Maya defaults to Independent Euler for rotation curves, it keeps track of total turns, multiples of 360. Euler Filter command in Graph Editor will attempt to smooth out the rotation curve so controllers don't rotate full 360 between key frames. Works most the time.

    Game engines will generally figure that out when transitioning between animations, you don't really need to worry about it in most instances as long as the pose at the end of one animation more or less matches the start of the next animation.
  • Mark Dygert
    If you bake animations, a key per frame, it shouldn't be an issue. 360 is the same as 0 as long as you don't interpolate between the two values. So technically it snaps from 360 to 0 but no one ever sees it move because it happens for two frames.

    If you really needed to micro manage it in Maya, you would just set two keys, (that happen within a single frame), but really that's annoying to deal with and if you're pipeline is baking keys don't bother.
  • rollin
    Offline / Send Message
    rollin interpolator
    But isn't this a bit too simple? Assume you go into slow motion in "this" game: the engine would have to heavily interpolate between the key frames - even with baked frames.
    What happens then?
  • Mark Dygert
    Slo mo is a pretty specific edge case but that falls under the "...as long as you don't interpolate between those values." part that can be a headache, lol. Most engines have interpolation settings, Unreal has them on anims, montages, blendspaces and I think on aim offsets. If interpolation is set to 0 the clips just play back to back with no blending, even if time is slowed. It happens on the tick level and as soon as one ends, the next begins.

    That is just "don't interpolate" but if you want blending while in slo-mo, between similar poses that have different values, you're asking for trouble...

    I worked on a game that had that and it ended up putting some pretty tight restrictions on the design, they where not too happy about it but that's the world we live in.  Slo-mo is a design feature that is good to know about early on, so you can build the systems and animations appropriately, to avoid blending issues. Having to retool an animation pipeline to account for slo-mo when the game is almost done is grounds to bury you're design team 6ft under the Nevada desert, heh.

    If it's a PvP multiplayer game, you probably won't be dealing with too much slo-mo unless you want everyone on the server to suddenly slow down because one player entered bullet time. You can slo-mo just those affected by whatever it is, spell, weapon firing or whatever, but it can look really weird, design really has to be on point for it to work. So it usually gets used for single player mechanics, where you can pause everything and no one cares. There are ways to pull it off in multiplayer games but it's very tricky and very specific to a particular aspect of the design, like the time dilation in EvE, that trickery doesn't work in a FPS. 

    ANYWAY... ahem, I'm getting sidetracked, heh.

    If you're going to do slo-mo and blending and have anims that blend similar poses (but have wacky values), you should probably live by "If you wind it up, you have to wind it down" and minimize the amount of wacky value poses you have to blend between.  Sometimes that means doubling the length of the cycle so values could ping-pong as opposed to just ping. Or doing something like, if they tossed a weapon in the air and it spun 0-720, they would catch it and spin it the other way 720-0 before returning to idle 0. 

    In a few cases where ping-pong isn't possible, you might need to make transitions that would take the values from where they where and put them where they needed to go. Sometimes that might be a flourish animation, or just a copy of the animation with it's values adjusted to a different "rail". Managing those files, hooking them up in game and QA'ing that could be a bit of a nightmare and higher ups should be aware of that if that's the kind of system they want. Most of the time money wins and design eats a bag of dicks, lol.

    Keeping slo-mo contained within certain animations and out of blend zones, can really help, again restraining design so the tech can function. I've worked on games that did "hit stops" where both attacker and the attacked played sync'ed animations those anims didn't blend and time wasn't actually slowed or interpolated, but the anims where just stretched or had their play rate adjusted, to look like they where in slo-mo. But that was only for those two characters. If you actually slowed time you would have to tightly manage whatever any other players where doing. That's something you should know up front when setting up the systems.

    TLDR: Set interpolation to 0 for anims that will have similar poses but different values. If you're a creative masochist start and end everything in the same values... good luck with that...
  • rollin
    Offline / Send Message
    rollin interpolator
    Just saying that e.g. Unity does interpolate by default and e.g. in my game the speed of attacks is bound to skill-values which can change.
    So dealing with 360°-resets will result in nasty flips as long as you're not doing freaky stuff like writing a handler script which does the trick (not saying I did something like that yet :lol: )

  • weltraumimport
    Thanks so much for explaining it so well!!
    I understand everything so much better now i really appreciate it. I just exported a baked animation to Unity and it worked out just fine!
Sign In or Register to comment.