Search Unity

Question "Transition offset" for Blend Tree (conceptual questions)

Discussion in 'Animation' started by DSivtsov, Nov 6, 2021.

  1. DSivtsov

    DSivtsov

    Joined:
    Feb 20, 2019
    Posts:
    151
    Have a simple Blend Tree BlendTree.JPG

    Also have a Transition to this Blend Tree
    TransitionToBlendTree.JPG

    When I tested this Transition I have the issue with animation in process of it: My Blend Tree use the "Run_ReTarg" animation, then I trigger the change state to "LeftRunJump" (transition works ok). Then begin transition to Blend Tree (based on Exit Time of that transition), but in process of that the animation is freezing on 1-2 frame (and may be also go back on 1-2 frame sometime) and after normal continue as normal Blend Tree Animation.

    I spent 1-2 hour trying to set different parameters for that transition nothing was helping.
    In the process of testing and trying to figure out this problem, I reload this scene several times, and after that it started working fine.
    I'm a little confused because I didn't understand, where the problem was and can the problem to return... and why it works now, because how the different animations are blended is understandable, but how the engine finds the right frame from "all blended frames" to blend with the currently playing animations is magic (except if the engine performs numerous calculations to find the most suitable frame among all existing ones in " combined frames")

    QUESTIONS

    How is possible to controlling the transition to Blend Tree?
    Is it possible to set "Transition offset" to Blend tree for "hard controlling" of transition for create the locomotion animation or Blend Tree doesn't right tool to create Character motions driven "by animation partially" ( e.g. the "Walk and Run animation" use the simple Blend Tree, but the "Jump Animation from Run" are controlling the "Character moving")?

    FYI My Animator Controller
    AnimatorController.JPG
     

    Attached Files:

    Last edited: Nov 6, 2021
  2. DSivtsov

    DSivtsov

    Joined:
    Feb 20, 2019
    Posts:
    151
    Partially SOLVED (but wanted a specialist, who is knows the how it was coded in realty, whicht can approve it):

    On first (and second) look the "transition offset to Blend Tree" works as it works in case of simple transition from one state (clip) to another state (clip).
    The transition offset parameter in case of Blend Tree will try to make smooth merge of two animations (or different animation frames from these animations) (where one frame will is taking from the current animation) and another frame will is taking from the Blend Tree animation corresponding to the "current blend of animations" (which based on current parameters of Blend Tree in my case it will based on the "Z & X speed" values) and the value is you set in the "transition offset" field for that transition.

    IMPORTANT NOTE.
    In case of transition to Blend Tree it wouldn't show in the Preview window of Inspector for this transition (versus as it common did for simple transition one clip to another).
    You can find correct value from the clip which will use the Blend Tree (which you awaiting will be used), based on Blend Tree parameters you are awaiting at transition time.
    In my case I wanted to receive animation in case when my Character Running, Make Jump at Running and landing and continue Run after landing (I set the "transition offset" basing on my "run" clip).
    What will be if Blend Tree was switched to "Walk" clip at transition time, I didn't checked.

    P.S>
    It's a logically and really to coding without enormous calculation therefore it can work effectively... but as it often in Unity :) it wasn't documented (or I can't find it :) :()
     
    Last edited: Nov 6, 2021