I'm building a controller with an arbitrary sense of "down", such that I can't use normal methods of camera movement.
I can move the camera on the up / right axes fine, but this creates unwanted "roll". I've looked around / tried a lot but can't find a good method of setting this camera rotation on an arbitrary "forward" axis without screwing up the other movement.
Any ideas?
Use quaternion multiplication to rotate the camera around the arbitrary up axis (you can use Quaternion.AngleAxis to find this) and its local x axis according to the relevant input (mouse used here as example):
Vector3 myUp = Vector3.up; // set with arbitrary up
float rotationSpeed = 1f;
// ...
float horizMouseMove = Input.GetAxis("Mouse X") * rotationSpeed;
float vertMouseMove = Input.GetAxis("Mouse Y") * rotationSpeed
transform.rotation = Quaternion.AngleAxis(horizMouseMove, myUp)
* transform.rotation
* Quaternion.EulerAngles(-vertMouseMove, 0f, 0f);