I am attempting to disallow rotations around the y axis as is implemented in the 360 video here: at https://www.omnivirt.com/ on a mobile device. If you look on your mobile device and tilt the phone left and right only manipulating the y value as seen in here (rotating like the hands of a clock):
there are no rotations over that axis. However in my implementation I am taking that gamma value and using it for a rotation around the y axis. I believe I need to disallow rotation around the y axis but still use gamma in calculations for other rotations in order to achieve a similar effect. I have the logic here for creating the device quaternion:
//Degrees to Radians conversion
var degtorad = Math.PI / 180;
var z = this.alpha * degtorad / 2;
var x = this.beta * degtorad / 2;
var y = this.gamma * degtorad / 2;
var cX = Math.cos(x);
var cY = Math.cos(y);
var cZ = Math.cos(z);
var sX = Math.sin(x);
var sY = Math.sin(y);
var sZ = Math.sin(z);
// ZXY quaternion construction.
var w = cX * cY * cZ - sX * sY * sZ;
var x = sX * cY * cZ - cX * sY * sZ;
var y = cX * sY * cZ + sX * cY * sZ;
var z = cX * cY * sZ + sX * sY * cZ;
var deviceQuaternion = quat.fromValues(x, y, z, w);
On this page ( https://math.stackexchange.com/questions/345145/nullify-zero-out-cancel-rotation-in-an-arbitrary-axis-in-a-quaternion ) I’ve found mathematical solutions but am not sure how to implement them.
I am looking for a way to modify my javascript code to achieve this effect. Thank you!