Search Unity

Resolved Transitions starting in random poses when using various sub-machines

Discussion in 'Animation' started by carcasanchez, Mar 8, 2021.

  1. carcasanchez

    carcasanchez

    Joined:
    Jul 15, 2018
    Posts:
    177
    Hello, fellow Uniters. I have lately run into a very strange issue with a complex animator, where I have various sub-state machines.
    The idea is simple: I am in a substate machine, doing a cycle of random animations, until a trigger is set and I jump to another state.
    But something is happening to transitions. Sometimes, when the trigger is set, the transition is done nicely. But the rest of the time, the rig "jumps" to a completely random pose, and then make the transition.
    It's very strange, because the transition is indeed happening, but not from the expected pose.
    I presume this is happening due to a bad configuration, where it somewhat stores some previous pose, and doesn't get to clean it when making another transition.
    But I can't put my finger on why this is happening, it's the first time I see this behavior.
    This is the animator main tree, with a random transition selected:
    upload_2021-3-8_11-34-46.png

    And this is one of the sub-machines (the exit transitions have just "has exit time" activated with no conditions). When a sub-machine finishes, if no trigger has been set, a script selects a random number, and the sub-machine transitions to itself, but in a different state. This seems to work always fine.
    upload_2021-3-8_11-35-19.png

    This is an example where everything works fine:
    https://i.gyazo.com/c6dbc5fa616d0b126500d5a6ee02ae8c.mp4

    But after a while, transitions start to get choppy:
    https://i.gyazo.com/c7569c23e6260552381e7ac3853fd919.mp4

    See that, before making the transition, the pose jumps to something completely random?

    I initially thought it could be a problem of trying to run a transition while already doing one, but I changed the Interruption Source and make sure I was not in the middle of any transition and still happening.

    Any hint on what the problem could be?
     
  2. carcasanchez

    carcasanchez

    Joined:
    Jul 15, 2018
    Posts:
    177
    Solved! The culprit here was the Cycle Offset, which was linked to a random parameter we set each time a state was entered. That's why the behaviour was, indeed, inconsistent.