We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › Tumble Camera Orientation Problem
Page Index Toggle Pages: 1
Tumble Camera Orientation Problem (Read 501 times)
Tumble Camera Orientation Problem
Jul 4th, 2006, 12:13am
 
Ho:
I am having a bit of trouble with my tumble camera. It is supposed to allow a user to use his mouse to tumble a camera around a particular focal point. mouseX spins the camera left and right while mouseY tumbles the camera vertically. The camera itself always rests in a spherical shell looking at a central focal point.

The tumbling itself works just fine, the problem is when the camera is looking directly down (in the –z direction) at the focal point. As it passes over the point, the camera flips itself PI radians and continues down. This causes a complete discontinuity in the motion. My guess is P3D (or Joggle, I guess) is forcing the z axis to always point “up”. Here my call to the camera function to set the camera position.
Code:

camera(camLoc.x, camLoc.y, camLoc.z, currentFocalPoint.x, currentFocalPoint.y, currentFocalPoint.z, 0, 0, -1);

//‘camLoc’ is the location the camera is placed at
//‘currentFocalPoint’ is the point the camera is looking at


Any suggestions on how I can solve this? I'd like a smooth orbiting camera to allow users to tumble objects in all direction.
Re: Tumble Camera Orientation Problem
Reply #1 - Jul 4th, 2006, 11:22am
 
The last 3 numbers in the camera() function are the "up" direction, in world co-ordinates. So P3D is doing what you're telling it to, e.g. when you go over the top, it flips itself so that upwards is in the direction of 0,0,-1.

If you want there to be no noticable change in up, you'll have to vary those last 3 numbers so that it does what you expect. I don't know off the top of my head what you need to do, but it may be a bit of work.

An alternative would be to rotate the object, instead of moving the camera.
Page Index Toggle Pages: 1