Question by
romeoxavier · Jun 25, 2020 at 12:27 PM ·
2djittering
Rigidbody 2D Jitter movement
When I walk into the wall my player jitters. Here's my PlayerController code:
using UnityEngine;
public class PlayerController : MonoBehaviour
{
public float speed = 10f;
private void Update()
{
float inputX = Input.GetAxis("Horizontal");
Vector3 movement = new Vector3(speed * inputX, /*transform.position.y*/ 0, 0);
movement *= Time.deltaTime;
transform.Translate(movement);
}
}
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613001747im_/https://answers.unity.com/themes/thub/images/avi.jpg)