I’m trying to make a character controller and when the character moves it stutters a bit along the x axis and looks like it’s teleporting.
The rigidbody2D and box collider all have default settings (z rotation is constrained though)
This is my movescript
{
public Rigidbody2D rb;
public float speed = 5000f;
public float stop = 0f;
// Update is called once per frame
void Update()
{
if (Input.GetKey("d"))
{
rb.velocity = transform.right * speed * Time.deltaTime;
}
if (Input.GetKeyUp("d"))
{
rb.velocity = transform.right * stop;
}
if (Input.GetKey("a"))
{
rb.velocity = transform.right * -speed * Time.deltaTime;
}
if (Input.GetKeyUp("a"))
{
rb.velocity = transform.right * stop;
}
}
}