Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

animation wont update/move after adding StateMachineBehaviour script onto the state

Discussion in 'Animation' started by CyberTurboPlays, Oct 26, 2015.

  1. CyberTurboPlays

    CyberTurboPlays

    Joined:
    Nov 7, 2014
    Posts:
    65
    hi
    i just keyed some simple ptA to ptB animation on a sphere with the buildin animation window in unity, and map out some input control to drive it, just to test out the new StateMachineBehaviour script that can be added onto the state now.

    before adding the script, animation can run and update like it should be, i mean it really move.

    then after i added the script and enable all those override methods that comes with the template, just to make them debug.log something for pure testing purpose. wel they all readout loud and ok in the console. then when i look at the game play window, i see the sphere is no long moving when i make the animation happen (all the debug log are still going fine), but the sphere now just pop to the end point when the animation is completed. instead of moving toward the end point while the state is updating

    i can confirm that when i disable (the tick mark in front) the StateMachineBehaviour script, the animation will move again, when enable back on, the sphere will pop to the end point after the animation is finished

    can someone do a simple test like this in yours and see if its a bug or something? i wonder if that would happen when i use actual skeleton animation coming from outside
     
  2. Mecanim-Dev

    Mecanim-Dev

    Unity Technologies

    Joined:
    Nov 26, 2012
    Posts:
    1,675
    if you did uncomment all the override method it does mean that you did also uncomment OnStateMove but without implementing any root motion. Thay why your model is not moving anymore

    Since your animated model is only one sphere, the sphere is the root of your animated model, and animation on the root can be overriden or changed at runtime with either OnStateMove or OnAnimatorMove.

    simply comment OnStateMove or call animator.ApplyBuiltinRootMotion()

    http://docs.unity3d.com/ScriptReference/Animator.ApplyBuiltinRootMotion.html
     
  3. CyberTurboPlays

    CyberTurboPlays

    Joined:
    Nov 7, 2014
    Posts:
    65
    so thats why, thank you for clarify