3 Axis Camera Rotation
I'm trying to make a camera controller with 6 degrees of freedom, and I've tried tons of methods and nothing is working.
What I want to have is two modes: one where moving the mouse left and right (Input.GetAxis("Mouse X")) results in "roll" of the camera (z axis rotation), while in the other mode left/right mouse motion results in "yaw" of the camera (y axis rotation).
In both modes, moving the mouse up and down (Input.GetAxis("Mouse Y")) should result in "pitch" of the camera (x axis rotation).
This seems simple at first, because theoretically you could just set the eulerAngles of the transform using each input axis.
However, here's my problem: I want the rotation to be done relative to the camera's current rotation.
What I mean by this is that no matter where the camera is looking, rotation is still performed in the same "direction".
For example, if the camera is looking downward, and we are in "roll" mode, then the camera should still roll looking downward, resulting in what is apparently y axis rotation (since z axis, or transform.forward, is now pointing the same way as the y axis).
Or, if the camera is pointing to the right, and the mouse is moved upward, then the camera should be apparently rotated in the z axis (as transform.right, which is the x axis initially, is now parallel with the z axis).
To summarize, the camera should apparently move in the same direction if the same mouse input is entered, no matter what the camera's current rotation actually is (even though in reality, the rotation being applied is different depending on where the camera is rotated).
Thanks for any help!
Can anyone please help? It would really help out :)