Search Unity

Root transform resets with animation transitions

Discussion in 'Animation' started by hideousarmor, Nov 14, 2018.

  1. hideousarmor

    hideousarmor

    Joined:
    Nov 14, 2018
    Posts:
    2
    Hello!
    Im relatively new to unity (been using it for 2 weeks only but Im familiar with 3d sculpting software)
    I have created a character with various attack animations for each input direction.
    If the input is right + attack, the character will attack to its right and end the movement forwarding a 90 dregree angle compared to it's original position
    Here's the attack in question and it's parameters. I will also mention that In game I have a script that activates Rootmotion whenever an attack is performed.

    As you can see he ends the attack looking at another direction. The problem is:
    whenever i make a transition into another animation, the model completely rotates.

    This happens ingame too, look closely at how it turns on that 3rd attack animation

    This doesnt happen if all of the attacks are in the forward direction, as you can see with the first two ones
    I have tried changing all of the root transform settings for each animation but nothing seems to work. If i disable bake into pose for the attack animation, then the transition in the preview window will look great but ingame the model will hardly move.

    What is it that im doing wrong? apparently the problem has nothing to do with root transform...the item has a parent object "controller" and I've noticed that the controller doesnt rotate following the attack animations, so this might be causing the problem, making the model reset to the same rotation the parent object has after attacking.

    How would I go about making it so that the parent object follows the root bone transform rotation while attacking? I dont even know how to find the root bone via code. Any ideas?
    Am i doing something else wrong?

    I've been stuck with this problem for a few days now and it's very frustrating, hopefully someone can help :)
    thanks in advance
     
  2. florianhanke

    florianhanke

    Joined:
    Jun 8, 2018
    Posts:
    426
    Hi there,

    I am relatively new here as well and have similar issues (https://forum.unity.com/threads/animation-root-rotation-preview-vs-game.585211/), and I'll give it a try at helping :)

    I am noticing that you bake the Root Transform Rotation into the animation, which means that the Root Node's rotation will not change anymore, it will only look like it does. So for the rotating attack, you should uncheck the Bake Into Pose checkbox, so that the Root Motion (well, Rotation) is applied to the Root Node of your avatar.

    I hope this helps – if not, please let me know so I can learn something :)

    All the best,
    Florian

    P.S: I just noticed you tried everything re bake into pose, sorry.
    P.P.S: OnAnimatorMove (https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnAnimatorMove.html) may be your friend for moving/rotating the parent. Get the root data from the animator, then apply it to the parent.
     
  3. Chapmania_Design

    Chapmania_Design

    Joined:
    Jan 27, 2017
    Posts:
    8
    Did you fix this? I possibly have a solution.
     
  4. johnsonalpha

    johnsonalpha

    Joined:
    Feb 20, 2015
    Posts:
    3
    What was your solution Chapmania?