Question by
Zeograth · Jan 30, 2019 at 08:13 PM ·
movementplayerprogrammingplatformerproblem during runtime
Player rapidly stutters back and forth while moving
I'm trying to create a 2.5d platformer and because of that my character's movement is restricted to the horizontal axis, the code I use lets him move and face the direction he's heading but whenever I move the thing keeps lagging backwards and forwards while moving.
void Update ()
{
float moveHorizontal = Input.GetAxis("Horizontal");
Vector3 newPosition = new Vector3(moveHorizontal, 0.0f, 0);
transform.LookAt(newPosition + transform.position);
transform.Translate(newPosition * speed * Time.deltaTime, Space.World);
Is what I'm using. The character is using a rigidbody, so I'm wondering if that might be the issue.
Regardless, how could I remedy this stuttering movement?
Comment