Index: /Users/ep/svn/blender.org/branches/ndof/source/blender/src/view.c =================================================================== --- /Users/ep/svn/blender.org/branches/ndof/source/blender/src/view.c (revision 11532) +++ /Users/ep/svn/blender.org/branches/ndof/source/blender/src/view.c (working copy) @@ -1029,6 +1029,8 @@ float m[3][3]; float m_inv[3][3]; float xvec[3] = {1,0,0}; + float yvec[3] = {0,-1,0}; + float zvec[3] = {0,0,1}; float phi, si; float q1[4]; float obofs[3]; @@ -1162,6 +1164,8 @@ /* Determine the direction of the x vector (for rotating up and down) */ /* This can likely be compuated directly from the quaternion. */ Mat3MulVecfl(m_inv,xvec); + Mat3MulVecfl(m_inv,yvec); + Mat3MulVecfl(m_inv,zvec); /* Perform the up/down rotation */ phi = sbadjust * rsens * /*0.5f * */ fval[3]; /* spin vertically half as fast as horizontally */ @@ -1179,8 +1183,18 @@ VecAddf(G.vd->ofs, G.vd->ofs, obofs); } - /* Perform the orbital rotation */ - phi = sbadjust * rsens * reverse * fval[4]; /* twist the knob, y axis */ + /* Perform the orbital rotation + If the seen Up axis is parallel to the zoom axis, rotation should be + achieved with a pure Roll motion (no Spin) on the device. When you start + to tilt, moving from Top to Side view, Spinning will increasingly become + more relevant while the Roll component will decrease. When a full + Side view is reached, rotations around the world's Up axis are achieved + with a pure Spin-only motion. In other words the control of the spinning + around the world's Up axis should move from the device's Spin axis to the + device's Roll axis depending on the orientation of the world's Up axis + relative to the screen. */ + //phi = sbadjust * rsens * reverse * fval[4]; /* spin the knob, y axis */ + phi = sbadjust * rsens * (yvec[2] * fval[4] + zvec[2] * fval[5]); q1[0] = cos(phi); q1[1] = q1[2] = 0.0; q1[3] = sin(phi);