Quaternion.Euler to rotate camera with input system V2's snaps camera to 0
Hey, I'm trying to make a system that rotates my camera with the right stick on a controller and with mouse axis data. I'm also using other scripts which moves my camera's rotation under some circumstances.
The problem is the method I'm using is to modify the camera rotation with a vector 2 that takes data from the vector 2's in the input system, but when I apply the rotation to my camera, I cant figure out how to make the stored value that I'm applying to the camera rotation take the cameras existing rotation into account, everything I've tried has had wonky results and I think I'm not understanding something basic about applying stored values to effect one another.
if (Input.GetKeyDown(KeyCode.Space))
{
print(rotationInput.y);
print(rotationInput.x);
}
if (isRotating)
{
rotationInput.y += ungodlyControlsInputAsset.PlayerControls.RotateCamera.ReadValue<Vector2>().x;
rotationInput.x -= ungodlyControlsInputAsset.PlayerControls.RotateCamera.ReadValue<Vector2>().y;
rotationInput.x = Mathf.Clamp(rotationInput.x, -clampValue, clampValue);
rotationSave = Quaternion.Euler(rotationInput.x, rotationInput.y, 0.0f);
transform.rotation = Quaternion.Lerp(transform.rotation, rotationSave, rotationSpeed * Time.deltaTime);
}
That debug reads 0 before I press any input, so if I press the input to rotate the camera, if the camera has been rotated by another process, it'll lerp between the cameras rotation before the input was pressed, then interpolate to 0. then everything works fine, if I print the debug again the values it reads will correspond to the transform.rotation data as expected, until another process changed the rotation again, then when I next press an input, the script will interpolate between the rotation it had at the time the rotation was modified by another process and lerp to whatever the prior stored values were within the rotationInput.x and .y vector 2 when I last pressed the input.
I just want the rotationInput.x and .y to stack with the cameras current rotation but I don't understand how to do this.