Hey, I’m using the new input system and I’m trying to get the right stick to control where the camera is looking, my games controls should allow the players camera to rotate freely in any direction (except z) including going upside down, but my code isn’t working.
Whenever the x rotation of the camera tries to go above the X rotation 90 or below the X rotation -90, the camera rotation tries not to pass that 90 mark and resets itself to 90, and if it could do this without stuttering I would call it good and move on, but the effect it has now is unacceptable.
Here’s what I wrote:
void Update()
{
currentRotation = transform.localEulerAngles;
Vector2 rotationInput = ungodlyControlsInputAsset.PlayerControls.RotateCamera.ReadValue<Vector2>();
Debug.Log(rotationInput);
float h = gamepadHorizontalSpeed * rotationInput.x;
float v = gamepadVerticalSpeed * -rotationInput.y;
currentRotation += new Vector3(v, h, 0f);
transform.localEulerAngles = currentRotation;
}
I hope you can help!