This example comes from the Java3D Tutorial.  It has a flaw in it that I ran into when I was learning about Quaternions under OpenGL.  When holding down the left mouse button, one should be able to move the camera/platform around as if they are looking in different directions -- what's commonly known as "mouse-look" in games.  If you do this a little, you may not immediately see the problem.  However, if you hold down the left mouse button and move the mouse in a circular motion (clockwise, for example) and then try to re-center your view, you'll see that you're now tilted.  The only way to re-center is to 'unwind' your view by moving the mouse in the opposite direction.
 
When I had this problem, it was because I was using a quaternion for my rotation. I wrote to Jeff Lander (a frequent writer in Game Developer's Magazine), his advice to me was to use a 2D Euler rotation rather that quats. At about that time, I changed jobs, languages (C++ to Java) and didn't touch any 3D code for a year, so I never got to fixing my app.
 
As I pointed out earlier, I'm a complete Java3D newbie.  Does anyone know how to fix this example?
 

MouseNavigatorApp.java

Reply via email to