Hello,
Anyone got any ideas on how to solve this please?
I’ve got a Normalised Quaternion, which is the output from the iPhone’s Gyroscope (obtained via Prime31’s DeviceMotion Plugin).
I’m trying to use this to directly control the camera view in Unity, so I would have a 360 degree rotation (ie. tilt the iPhone up = Unity camera points up, rotate the iPhone 90 degrees to the right = Unity camera turned 90 degrees right, etc.) - this is similar to the control system in N.O.V.A 2.
The problem I have when applying the Quaternion given from the Gyroscope is as follows:-
-
Everything is fine whilst facing forward, I can turn the camera a bit to the left or right, and up and down OK, and also return to facing forward without too much drift.
-
HOWEVER, if I turn 90 degrees to the right (or left), AND THEN attempt to look upward, the Unity camera rolls instead of tilting upward.
-
From the position of 90 degrees to the right, I have to roll the iPhone in order to make the view tilt upward.
Can anyone suggest a way to interpolate the Quaternion so that the Unity camera is pointing in the same direction that the back of the iPhone is facing?
Many thanks for your assistance - it’s driving me mad.
Rob.