I have a RigidBody playermodel and inside it I have an empty gameobject called FollowTarget for the camera to follow. FollowTarget contains code to rotate camera on Y axis. The playermodel itself rotates the camera on X axis, but because it’s with RigidBody, it makes the camera rotation bumpy. How do I make the camera movement smooth, but also make the playermodel rotate on X axis on mouse movement? If I give FollowTarget both Y and X mouse input, then how do I also make my player rotate on mouse’s X axis?
FollowTarget code:
void Update()
{
mouseX += Input.GetAxis("Mouse X") * mouseSens;
mouseY += Input.GetAxis("Mouse Y") * mouseSens;
mouseY = Mathf.Clamp(mouseY, minAngleY, maxAngleY);
transform.localRotation = Quaternion.Euler(-mouseY, 0, 0);
}
Player rotation code:
rb.MoveRotation(rb.rotation * Quaternion.Euler(new Vector3(0, mouseX * 200f * Time.fixedDeltaTime, 0)));