I tried to get full camera rotation by putting horizontal rotation on the right button and vertical rotation on the middle button, but because there are 0s for the other two axes the camera snaps back to the original height/direction whenever I switch from one button to the other.
How do I get smooth full camera rotation on one button?
This is the tutorial I finished when I decided to try getting 3d rotation.
private void RotateCamera(InputAction.CallbackContext obj)
{
if (!Mouse.current.middleButton.isPressed)
return;
float inputValue = obj.ReadValue().x;
transform.rotation = Quaternion.Euler(inputValue * maxRotationSpeed + transform.rotation.eulerAngles.x, 0f, 0f);
}
private void RotateCameraa(InputAction.CallbackContext obj)
{ if (!Mouse.current.rightButton.isPressed)
return;
float inputValuee = obj.ReadValue().y;
transform.rotation = Quaternion.Euler(0f, inputValuee * maxRotationSpeed + transform.rotation.eulerAngles.y, 0f);
}
8317407–1091556–CameraMovement.cs (7.04 KB)