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

Root rotation from previous animation

Discussion in 'Animation' started by kryzysaa, Feb 11, 2015.

  1. kryzysaa

    kryzysaa

    Joined:
    Dec 10, 2014
    Posts:
    4
    Hi,
    is it possible to read root rotation from animation and apply that to next animation in tree.
    I have blend tree "walk". One walk animtion and i used it to walk right, left, right _45deg, left_45deg etc.
    I made 5 clips and applied rotation in inspector(-90, -45, 45 90 deg).
    Now I want to add jump animation with direction from walk.
    For Example.
    When I walk right and hit "jump", character, in jump state, turns to default direction(front)
    Is there any way to resolve it without making 4 jumps in every directions and applying it to blend tree?

    Thanks.
     
    Last edited: Feb 11, 2015
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    If you are using an Animator component then simply override OnAnimatorMove
    http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAnimatorMove.html

    Any code changing the root game object should be done in OnAnimatorMove

    then write some code that detect in which state your are and if you are in Walk state and jump key is pressed adjust your transform rotation.