PDA

View Full Version : HELP: 'Descent' style camera

sixb0nes
08-10-2000, 08:51 AM
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 (http://www.xpression.org)

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

shawge
08-10-2000, 10:16 AM
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.

sixb0nes
08-10-2000, 10:23 AM
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 (http://www.xpression.org)

shawge
08-10-2000, 11:04 AM
Have you tried using quaternions instead of sin/cos? There are quite a few tutorials on the web regarding this subject.

sixb0nes
08-14-2000, 07:45 AM
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 (http://www.xpression.org)

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

shawge
08-14-2000, 09:30 AM
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);

sixb0nes
08-14-2000, 09:52 AM
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() http://www.opengl.org/discussion_boards/ubb/smile.gif

-chuckle-

Thanks for your responses thus far,
sixb0nes www.xpression.org (http://www.xpression.org)

Kwan
06-23-2006, 06:33 AM
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.