Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

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
     
unityunity