The idea here is simple: I need to rotate the camera to provide the effect of rolling in first person. My major concern is that I want to rotate the camera on the x axis beyond 360 degrees. I am using Quaternion.Lerp for rotating.
//Inside the update function
EndAngle = Quaternion.Euler(5, 0, 0);
StartAngle = Quaternion.Euler(25,0,0);
if (tParam < 1)
{
tParam += Time.deltaTime * lerpSpeed;
Camera.main.transform.rotation = Quaternion.Lerp(StartAngle, EndAngle, tParam);
}
if (tParam >= 1)
{
tParam = 0;
}
Here is working code I am using to rotate the camera from 25 to 5 degrees. Of course, I want to start at 5 and end at 365(5). I would however like the lerp to start at whatever the current rotation angle on the x axis is for the camera, but am wary that using StartAngle = Camera.main.transform.rotation.x will result in the StartAngle updating constantly. How should I go about taking the starting angle of the camera in an efficient manner?
tl;dr
How should I make the camera rotate to 365 degrees? (And should I use slerp to make the roll more realistic?) Thanks for any help in advance