HELP: 'Descent' style camera

Greets -

I’m working on a camera that will mimic the style of the ‘Descent’ series by Interplay.
(360o rotation and movement) To this point, I can move along a single Y plane, but can’t seem to figure out the equation for variable Pitch. I am already storing pitch in cam->Pitch for rotation.

cam->LocX -= sin((cam->Yaw + dangle) * (M_PI180)) * dsize;
cam->LocZ -= cos((cam->Yaw + dangle) * (M_PI180)) * dsize;

I know I can’t just add Y in there with a sin() on the pitch, because that will throw my
other values off kilter. Can anyone point me in the right direction and/or give me a
good url for other geom stuffs.

Thanks,
sixb0nes www.xpression.org

[This message has been edited by sixb0nes (edited 08-10-2000).]

Take a look at fooDave’s site: http://personal.nbnet.nb.ca/daveg/opengl/

He has some code on Quaternions and cameras. The descent style camera is at http://personal.nbnet.nb.ca/daveg/opengl/camera/index.html#CameraB

Hope this helps.

shawge, thanks …

I’ve been to f00dave’s … but I was looking for some background on the actual trig
involved in the equation.

Thanks,
sixb0nes www.xpression.org

Have you tried using quaternions instead of sin/cos? There are quite a few tutorials on the web regarding this subject.

shawge,

Was hoping to avoid quats for now. I know this must be a pretty simple solution, but
I can’t seem to draw it out on paper …

Anyone?
sixb0nes www.xpression.org

[This message has been edited by sixb0nes (edited 08-14-2000).]

Have you tried something like the following?

// move camera
glTranslatef(-camera_pos[0], -camera_pos[1], -camera_pos[2]);

// Rotate X, Y, Z
glRotatef(camera_roll, 0.0f, 0.0f, 1.0f);
glRotatef(camera_yaw, 0.0f, 1.0f, 0.0f);
glRotatef(camera_pitch, 1.0f, 0.0f, 0.0f);

shawge,

The problem I’m having is solving for the new location, not the rotation. The above
calc I use will not solve for a varying Y (think Quake without jumping/etc) camera.

I think I’m getting closer now, by applying
sin(cam->Pitch) to the z movement, I can determine appropriate z speed.

Perhaps I’m completely off whack here… or
maybe I should just give up and use gluLookAt()

-chuckle-

Thanks for your responses thus far,
sixb0nes www.xpression.org

You can look at my camera tutorial.

http://kengine.sourceforge.net/tutorial/vc/camera-eng.htm

This tutorial describe the descent, first person and spectate camera moving.