# Moving camera

8 replies to this topic

### #1rogerdv

Member

• Members
• 99 posts

Posted 21 August 2003 - 03:23 PM

I want to move the camera following a circle around a point. Im using gluLookAt, so I know that I only have to change the first vector (the position of the camera) and leave the target unmodified. Can somebody suggest me an idea?

### #2davepermen

Senior Member

• Members
• 1306 posts

Posted 21 August 2003 - 08:08 PM

using sine and cosine (wich take radians.. not degrees :D) to calculate your position..

and yes, leave your target unchanged, of course.. :D
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #3rogerdv

Member

• Members
• 99 posts

Posted 21 August 2003 - 08:21 PM

But how do I convert that to opengl coordinates (x,y,z)? Sorry, Im bad with maths.

### #4davepermen

Senior Member

• Members
• 1306 posts

Posted 21 August 2003 - 08:47 PM

hm..

ydistfrommidpoint = 0;

cameraxpos = xdistfrommidpoint + midpointx;
cameraypos = ydistfrommidpoint + midpointy;
camerazpos = zdistfrommidpoint + midpointz;

hope that inspires you..

oh, and math is the most important thing in graphics, quick! catch up! vector math all the way! its not much actually..
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #5rogerdv

Member

• Members
• 99 posts

Posted 21 August 2003 - 09:44 PM

Thanks a lot! Ill try that tomorrow. Maybe some kicks in the head in the training session now clear my mind.

### #6Jesse M

Member

• Members
• 32 posts

Posted 22 August 2003 - 02:03 AM

Our graphic-programmer forebears would laugh. The advent of the device-independant graphics API has stolen away our knowledge of simple 3D math. :lol:

I remember the day I was squeezing every processor tick out of my 3D routines. All for not I guess...
FRAG THE PLANET
Ed Helms: Alcohol causes problems and guns solve problems. I don't see why you can't have guns in bars.
Other guy: That's a stupid idea.
Ed Helms: Yeah, if your a pussy.

### #7davepermen

Senior Member

• Members
• 1306 posts

Posted 22 August 2003 - 05:37 AM

and yeah.. todays apis allow you to "forget about 3d".. but just to render some cubes or so.. at the first point after THAT, you'll learn that you need to understand math anyways..

and once you do, the world is so much simpler...
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

### #8anubis

Senior Member

• Members
• 2225 posts

Posted 22 August 2003 - 12:50 PM

luckily programable gpus reintroduce math to 3d programming...
If Prolog is the answer, what is the question ?

### #9davepermen

Senior Member

• Members
• 1306 posts

Posted 22 August 2003 - 01:29 PM

partially, yes:D
davepermen.net
-Loving a Person is having the wish to see this Person happy, no matter what that means to yourself.
-No matter what it means to myself....

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users