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

Best practice question for blending movement and rotation

Discussion in 'Animation' started by Cross22, Jun 18, 2016.

  1. Cross22

    Cross22

    Joined:
    Sep 26, 2014
    Posts:
    22
    I have set up my animator controller with a 2D cartesian blendtree that takes X and Y values. These then map to forward/back/strafe left/strafe right animations. When the values are (0,0) I want to play an idle animation, so that one got added to the blend tree as well. My code sets these x/y values using SetFloat() with damping and everything looks good.

    Now turning in place also needs to be handled. I tried to create a separate blendtree that takes a [-1..1] turning value to play the stationary turn left/turn right clips, but that seems to be fighting with the idle animation defined above.

    What is the recommended approach to handle this scenario?
     
  2. SethMeshko

    SethMeshko

    Joined:
    Sep 20, 2014
    Posts:
    109
    You will need to set up a secondary blendtree with all of your pivot animations and then create an exit such that it mandates that you exit to the pivot blendtree from idle before entering the locomotion blendtree.

    So Idle state is the default and is exited to from either blend tree when values are 0. Have the idle state only exit to the pivot blendtree when there are input values. Have the pivot blendtree exit to the locomotion blendtree on exit time. Make sure that your blends from the pivot tree allow for the full pivot before transition.

    Hope that helps