Search Unity

  1. The 2022.1 beta is now available for testing. To find out what's new, have a look at our 2022.1 beta blog post.
    Dismiss Notice

Preventing forceful transitions from Any State

Discussion in 'Animation' started by unity_05B59064C1E7A73BFCFC, Oct 28, 2021.

  1. unity_05B59064C1E7A73BFCFC

    unity_05B59064C1E7A73BFCFC

    Joined:
    Sep 1, 2021
    Posts:
    5
    I've got a sub-state machine responsible for locomotion of a character when it is unarmed or holding a weapon. I've created one blend tree for each of the two states above as shown below:



    The problem I have is two-fold:
    - on one hand both the transitions from Any State must not be allowed to transition to self (Can Transition To Self set to false) otherwise the Locomotion state never completes and keeps being interrupted.
    - on the other hand, any animation that interrupts locomotion does not blend back to locomotion and instead the Any State -> Locomotion transition is triggered all over again, which has the side-effect that a falling animation isn't played continuously until the character is grounded.

    I think this is happening because the transitions from Any State to Locomotion rely on the condition that the parameter CurrentWeapon is a given value (< 1 for Unarmed; == 2 for Great Sword). This parameter is set once when the weapon is equipped because I'm thinking of relying on it to play attack animations.

    How can I make it so transitions back to Locomotion aren't interrupted by transitions from Any State to Locomotion?

    BTW, I looked into animation overrides but they cause the character to jerk when the runtime controller is changed.

    EDIT
    Here is the base layer:


    And the Airborne sub-state machine:

     
unityunity