Question by
tjanok · Feb 09, 2021 at 07:28 PM ·
rotationquaternion
Rotate plane in relation to camera
I have a plane that I would like to rotate (tilt) on two axis via the mouse. The main camera can move around, so moving the mouse up/down, and left/right, should tilt the plane the same way in relation to the camera.
For the up and down motion, this seems to work correctly:
float pitch = Input.GetAxis( "Mouse Y" ) * 50.0f;
transform.Rotate( pitch * Camera.main.transform.right, Space.World );
However, I can't seem to rotate on just the X/Z axis (depending on where the camera is located). The mouse X axis should tilt the plane left or right. But it seems to rotate on multiple axis at once.
Any insight would be appreciated!
Comment