Hi again,
I wrote a simple demo program for a SpaceMouse-with-Three.js application which processes raw sensor data of a SpaceMouse (see initial post of this thread) into an intuitive control of all six axes in 3D space.
Rotation:
Each axis of rotation can be independently controlled, without tainting the rotation of the remaining axes, and without sacrificing their simultaneous control. Control of Roll-axis can easily be disabled, by setting one variable to ‘false’. This is the default setting which I suggest novices at 6DoF devices keep until they have acquired the necessary level of opto-motorical coordination skills.
Attached to the camera is an (invisible) orthonormal coordinate system, aligned with the camera’s line-of-sight and up-direction, which I’m showing from a 3rd-person perspective for documentation purposes only:
Note the red/blue/green camera-axesHelper:
blue: line-of-sight
green: up-vector
red: side-vector
Translation:
When rendering the 1st-person view of the SpaceMouse-controlled camera, puck-displacement forward-backward corresponds to the camera dollying along the line of sight (blue). Likewise will a puck displacement along the red line effect a “horizontal” pan in screen space, and a puck-displacement along the green line a “vertical” pan in screen space.
Except for an import of Three.js the file is completely self contained and comprises approx. 300 LOC, including comments and minimal HTML.
Prerequisites:
SpaceMouse or SpaceNavigator
compatibel (i.e. WebHID enabled) browser.
WebHID.html (12.0 KB)