Right now I'm trying to use 1D Blend tree in Animator to smooth animation from idle to walk to run.
But I face a problem that I don't know why it does that.

I use Store Speed node to set the parameter in the Blend tree to Object Horizontal Speed. And then I use the keyboard to move the object but the Horizontal Speed keeps changing back and forth between 0 and 2 (I set moveSpeed to 1)

My question is: Why does Horizontal Speed keep changing between 0 and 2 despite the fact that I set movespeed Variable to 1.

Because this problem that I don't know why it does that so my Blend tree parameter also keep changing back and forth between 0 and 2. So you know my animation look jerking. (= =!)

I only use Move node, Store Speed node and set Animation node in Fixed update Machine.
  • Use Update instead of Fixed Update. The Move node is to be used per frame (i.e. using update), fixed update will cause the movement to only occur every fixed frame, so the movement won't be smooth.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • edited August 2019
    Thank! That clears the why out my mind.
    But does it occur anything weird with physic if use Move Rigibody in Update machine?
    They said I only use physics-based movement on Fixed Update.
    But don't know anything will go wrong with Update or not.
    Post edited by Night on
  • Hm, in that case using fixed update should be fine - an object's speed is determined by checking position changes per frame, so using via rigidbody in fixed udpate should work.

    I'll do some tests.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Alright, working fine here - make sure your input keys have In Fixed Update enabled when they're used in a fixed update machine.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Working fine? Why on my end it not?
    And yes my input Horizontal and Vertical had Fixed Update enabled.

    I just use Move node and Store Speed node with Speed Variable set to 1.
    And I can clearly see the Horizontal Speed in "Object Change" Script is changing back and forth between 0 and 2 and not a constant speed. Even though I use it in Update machine. :(
    The change even more dramatic when I set Speed Variable to a higher number. Let say 10 it will be changing somewhere between 5 and 20.

    Also to let you know that despite I use Move Position in Move node I got 0 Velocity even the "Object Change" show Horizatal Speed > 0. Why is that?

    Only when I use Add Force I got a constant speed and constant Velocity.
  • Is your rigidbody set to be kinematic? If not, try enabling that.
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Yeah! Turn on rigibody to be kinematic is work, Speed and Velocity is now the same and constant

    But that lead to another problem of my gameplay, turn on kinematic will make my player can't stay on planform (I'll not parent player to the platform that will lead to another problem later on) and if I turn on gravity in the Move node then my character just sinks through the ground.

    Haizz! Maybe I stick with the Add force then. Your move node is great for the beginner just want a character to move, but isn't if I want to make advance character system.

    Thank you for your help :)
  • edited August 2019
    Yeah, advanced stuff needs advanced functionality/setup :)

    Also, it's always a good idea to check Unity's scripting reference in case there's something that needs to be considered. While Makinom tries to make it as easy as possible for you, things might not behave the way you expect due to not being used the way Unity wants you to.
    Post edited by gamingislove on
    If you're enjoying my products, updates and support, please consider supporting me on patreon.com!
  • Alright! I will check Unity scripting reference more.
    Thank!
Sign In or Register to comment.