Search Unity

Unity Dev, why animator resets bone to default position?

Discussion in 'Animation' started by MarkenhXu, Mar 4, 2021.

  1. MarkenhXu

    MarkenhXu

    Joined:
    Oct 11, 2018
    Posts:
    4
    Hi Unity Devs

    I found a post that says "Unity animation reset all bones every frame to their original position and then set to current frame position." and this seems to be true in my personal experience.

    Here is a simple example

    Here is what I want to do:
    - When character performs a throwing animation, I want to spawn a fire ball at the character's hand bone position at specific animation key frame. (or animation normalized time.)

    Step to recreate the problem:
    - Have an character animated to do a thowing animation
    - add a StateMachineBehaviour script to this animation and Debug.log the position of the hand bone during OnStateUpdate.
    - then you will see the position returned will always be the starting position of that animation.

    Same thing happens if I use key frame events.

    The only way I got around this is to have the StateMachineBehaviour set a bool flag in a seperate script. and that script's update loop will check for the bool flag being changed and then then check the animated bone position. Since it is now happening outside of the animator it gives me the right position.

    Is this an intended behaviour, am I just missing some check box somewhere that could change the behaviour of the animator?

    Thanks guys
     
  2. meg97

    meg97

    Joined:
    Sep 29, 2020
    Posts:
    3
    Up, I'm also looking for the correct way to call events during animations without getting the wrong bone position.