Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Neural Nets, Genetic Algorithms, and thrust vectoring spaceships...

This topic is 6074 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Thats the idea, of course. Im still in the middle of developing how the ships fly around. And thats the problem. 1 ship is going to chase the other, but the camera needs to follow the one that is doing the chasing. what i have so far is 2 ship (nicely modeled in milkshape by yours truely). the camera is above and in back of the chaser ship, and you know in opengl, the camera does not move, so the ship can''t move. how do i get the correct rotation and translation on the other ship compared to the chaser ship? I have tryed alot of different things, and i plan on trying more, but, a little help cant hurt. Thanks.

Share this post

Link to post
Share on other sites
OpenGL has the camera fixed at the origin (0,0,0). If you need your camera at any other location, you can''t. Instead, you have to move the world :-)
To move the world, simply make your GL_MODELVIEW matrix contain the inverse translation of your camera. So if your camera is at 1,2,3
then you would call:
glMatrixMode (GL_MODELVIEW);
glTranslatef (-1, -2, -3);

The same goes for rotation.

Share this post

Link to post
Share on other sites
I think Kippesoep was right about not being able to move the camera, But translating the whole world in the oppersite direction is equivalent(like he said).

I call gluLookAt each frame with the camera position. You can also choose a target. The up_vector referes to the vector which points out of the top of the camera.

Look at the OpenGL Redbook (proggramming guide) for a great explaination of viewing and camering. I belive there is an online version.

void mainloop()
glLoadIdentity(); //important


//or glutSwapBuffers

Share this post

Link to post
Share on other sites
Ahh...thanks for all your ideas. I used quadernions and got it working. The reson being,

glRotate (Pitch,1,0,0);

will not work together. But thanks alot.

take it easy,

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!