Hi all, I’m trying to develop a Cardboard app where the JME camera points in the same direction is the phone. However, although I’m able to get the phone’s orientation (using SensorManager.getOrientation(), which returns yaw, pitch & roll), I’m having real problems using these figures to point the camera in the same direction.
I’ve tried the following:-
float orientation = /* android sensor code */; float newOr = new float; // The order is different between Android and JME's yaw/pitch/roll newOr = orientation; newOr = orientation; newOr = orientation; cam.setRotation(new Quaternion().fromAngles(newOr));
The above code almost works. If I replace “newOr = orientation;” with “newOr = 0;” (to cancel out the yaw received from Android) then looking up/down and rolling left/right work great (but no turn left/right though). But when I have the code exactly as above, everything goes haywire. I must have read loads of pages on Stack Overflow but to no avail. Someone else must have written this code before, but I’m stuck. Any help is much appreciated!