Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

How to make blend tree play one animation at a time...hear me out.

Discussion in 'Animation' started by ShervinM, Nov 26, 2018.

  1. ShervinM

    ShervinM

    Joined:
    Sep 16, 2017
    Posts:
    67
    Hi there!

    In my game I'm using nested blend trees for my attack system. I'm doing this to accomplish two things:
    1. When the attack button is pressed, based on a parameter value <<AttackNo>> in the animator, the first blend tree chooses which attack should be played. The flow goes to another blend tree...
    2. This second blend tree uses two parameters (x and y) to determine which direction the player is facing, so as to play the correctly oriented (left, down, right,up) animation clip of that specific attack.

    I've attached an image of what I'm talking about.

    Now, I understand the primary use of blend trees. It is after all a mechanism to smoothly blend between animation clips. I chose to use them not for blending, but rather a nice way to "Switch" between possible states (ie different attacks in a sequence).

    In reality, I dont want any blending at all. When the attack button is pressed, I want it to branch through to one of the clips, play that clip and exit out entirely. However, for instance if I hit attack while facing West, and as the animation clip is playing I decide to move my player to face East, that second blend tree switches to the East Animation.

    Is there any way I can make sure that whatever animation gets selected to play, plays and never blends to anything else? Or is my only option to create this "switching" through my own states?

    For more information:
    1. The transition to the first blend tree has no exit time
    2. The transition(s) out of the blend tree has an exit time set to 1


    Thanks so much for any help/insight you may have!
     

    Attached Files:

    Carrotpie likes this.