Help animation stuttering Problem - Unity

Discussion in 'Game Development (Technical)' started by Kuroda, Oct 10, 2019.

  1. Kuroda

    Kuroda New Member

    Jul 25, 2019
    Likes Received:
    Solved, solution at the bottom

    I got this problem of the IA movement Logic and the transitions between Walk and Idle animations.

    Here is the video of the problem:

    Here is the Code:
    //IA Movement Logic
                Timer_f -= Time.deltaTime;
                if (Timer_f <= 0)
                    PosicionBallY_f = GameObject.Find("Ball").transform.GetChild(0).transform.position.y;
                    Timer_f = 0.1f;
                if (((this.transform.position.y + ((this.transform.localScale.y / 3))) >= PosicionBallY_f) && ((this.transform.position.y - ((this.transform.localScale.y / 3))) <= PosicionBallY_f))
                        Animacion.SetFloat("Move", -1f);
                        Player_rigid.velocity =;
                    Animacion.SetFloat("Move", 1f);
                    if (this.transform.position.y > PosicionBallY_f)
                        Player_rigid.velocity = new Vector2(0, Speed_f * -1);
                    else if (this.transform.position.y < PosicionBallY_f)
                        Player_rigid.velocity = new Vector2(0, Speed_f);
    in advance thanks for the help.

    This is the solution:

    if (Mathf.Abs(Player_rigid.velocity.y) <= 0)
           Animacion.SetFloat("Move", Mathf.SmoothStep(Animacion.GetFloat("Move"), -1f,0.2f)); 
    #1 Kuroda, Oct 10, 2019
    Last edited: Nov 7, 2019

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer