Search Unity

Can someone please help me achieve better movement with rigidbody?

Discussion in 'Scripting' started by Deleted User, Feb 13, 2016.

  1. Deleted User

    Deleted User

    Guest

    When my character runs into a corner it starts to twitch if I use my own scripted movement but if I use the third person controller in the standard assets pack the character behaves normally.

    Here is my code.

    Code (CSharp):
    1. void FixedUpdate()
    2.     {
    3.         rigidbody.position = Vector3.MoveTowards(rigidbody.position, rigidbody.position +
    4.             (new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"))).normalized, Time.deltaTime * 5);
    5.     }
     
  2. gorbit99

    gorbit99

    Joined:
    Jul 14, 2015
    Posts:
    1,350
    Try adding a physics material to the player with 0 friction
     
    Deleted User likes this.
  3. Deleted User

    Deleted User

    Guest

    That was all it took! You are my hero.