Hello.
I’m using Cinemachine and the new InputSystem to make a first person camera. I’ve completed that task, but when I’m executing the game, when I move the player and the camera at the same time, it has some nasty jittering, and I don’t know exactly why. Here’s my code:
public class PlayerMovement : MonoBehaviour
{
[SerializeField]
private float moveSpeed;
private Vector3 movement;
private Rigidbody rb;
private Transform cameraOrientation;
private void Awake()
{
rb = GetComponent<Rigidbody>();
cameraOrientation = Camera.main.transform;
}
private void FixedUpdate()
{
//I'm using another class to get the values from the input
Vector2 move = InputManager.Instance.GetPlayerMovement();
movement = new Vector3(move.x, 0, move.y);
movement = cameraOrientation.forward * movement.z + cameraOrientation.right * movement.x;
movement.y = 0f;
rb.velocity = movement * moveSpeed;
}
}
Thanks in advanced