So I use this code, with a Rigidbody attached to my GameObject (player)..
using UnityEngine;
public class Player : MonoBehaviour {
{
public float speed = 4f;
private float movement = 0f;
public Rigidbody2D rb;
private void Update()
{
movement = Input.GetAxisRaw("Horizontal") * speed;
}
void FixedUpdate ()
{
rb.MovePosition(rb.position
+ new Vector2(movement * Time.fixedDeltaTime, 0f));
}
}
The problem is the movement feels jerky / not smooth. It might just be me, though.
No, this is not a duplicate of a similar question. I am using other code and it's not totally similar to what I'm doing