Re: [Plib-users] Newbe Question
Brought to you by:
sjbaker
From: Dave M. <dp...@ef...> - 2001-09-30 16:00:24
|
I got started with PLIB by looking at plib/examples/src/ssg/tux/tux_example.cxx ; the function of interest is sgSetCoord()... void sgSetCoord ( sgCoord *dst, const SGfloat x, const SGfloat y, const SGfloat z, const SGfloat h, const SGfloat p, const SGfloat r ) ; This is used in tux_example.cxx like this sgSetCoord ( & campos, 0.0f, -5.0f, 1.0f, 25.0 * sin(frameno/100.0), 0.0f, 0.0f ) ; ssgSetCamera ( & campos ) ; Playing around with this, you should be able to implement your flying code. You can also look at the viewer example which lets you zoom and orbit a fixed point. You can also use quats or build matrices yourself... http://web2.airmail.net/sjbaker1/matrices_can_be_your_friends.html Manipulating direction vectors and quats have some advantages you'll appreciate later like interpolation and immunity to gymbol lock. Camera systems can get very sophisticated and complicated, especially in collision avoidance, but that should get you going. --Dave McClurg ----- Original Message ----- From: Red <red...@ya...> To: <pli...@li...> Sent: Saturday, September 29, 2001 9:58 PM Subject: Re: [Plib-users] Newbe Question What I was wondering was, how do you deal with roll, pitch, and heading? I know for a walk through you have something like: file://turn right heading -= 1.0f; yrot = heading; file://turn left heading += 1.0f; yrot = heading; file://move foward xpos -=sin(heading*piover180); zpos -=cos(heading*piover180); then: rotate everything translate everything draw to screen I have no idea how to get from this to some basic flying code. I expiramented with some ideas, tried to come up with what the math might look like, but nothing works. So if someone could point me in the right direction, that would be great. |