Jump to content
  • Advertisement
Sign in to follow this  
Noxir

omg

This topic is 4879 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

Anyone knows how to make the screen follow the player? I tried glTranslatef(mapx, mapy, mapz) and then I moved the map when the player were moving but it aint working it's totally weird somebody help me or give me a code or tutorial plz plz plz :/

Share this post


Link to post
Share on other sites
Advertisement
You're a posting machine! Consider making 1 post with several questions :P

glTranslatef(); is only for translating poly's I believe.

until someone more compitant posts, you could try making the perimeters for the function gluLookAt(); be attached to your character's movement. I'm not really sure if that'll work, but it'll give you something to try :)

I myself haven't been able to get gluLookAt(); to work inside the gldrawscene loop, so for all I know it's probably impossible.

Another promising function you might want to look at is gluPerspective(); Again, i'm not sure what that one does, but the name gives me images of what it MIGHT do ;)

Share this post


Link to post
Share on other sites
aye thanks but I already found it out ^^ maybe i should stop posting this much
it was this simple:

py += 0.1f;
groundy -= 0.1f;
mapy -= 0.1f;

Share this post


Link to post
Share on other sites
You'll find the typical camera, and gluLookAt(), will actually move the world around the camera rather than the camera around the world. It does seem weird and takes a lot of explaining so I won't bother. However, if you put glTranslatef(-mapx, -mapy, -mapz) before you do any of your drawing it will draw the netire world offset so as to make it look like the camera has moved. Take note that there is a '-' before the values as moveing the world to the left, makes it look like the camera has moved to the right so you pass the reverse values of where you want the camera to be.

As a side note, and following on from the previous poster, might I suggest you try make your post titles more appropriate in future. Many people completely ignore such threads purely because of the title so it's in your best interest to ensure your posts are clear and polite.

Hope that was of some use.

Share this post


Link to post
Share on other sites
Quote:
Original post by ghosted
You'll find the typical camera, and gluLookAt(), will actually move the world around the camera rather than the camera around the world. It does seem weird and takes a lot of explaining so I won't bother. However, if you put glTranslatef(-mapx, -mapy, -mapz) before you do any of your drawing it will draw the netire world offset so as to make it look like the camera has moved. Take note that there is a '-' before the values as moveing the world to the left, makes it look like the camera has moved to the right so you pass the reverse values of where you want the camera to be.

As a side note, and following on from the previous poster, might I suggest you try make your post titles more appropriate in future. Many people completely ignore such threads purely because of the title so it's in your best interest to ensure your posts are clear and polite.

Hope that was of some use.


Thanks, I will :)

Share this post


Link to post
Share on other sites

You'll find the typical camera, and gluLookAt(), will actually move the world around the camera rather than the camera around the world. It does seem weird and takes a lot of explaining so I won't bother. However, if you put glTranslatef(-mapx, -mapy, -mapz) before you do any of your drawing it will draw the netire world offset so as to make it look like the camera has moved. Take note that there is a '-' before the values as moveing the world to the left, makes it look like the camera has moved to the right so you pass the reverse values of where you want the camera to be.

As a side note, and following on from the previous poster, might I suggest you try make your post titles more appropriate in future. Many people completely ignore such threads purely because of the title so it's in your best interest to ensure your posts are clear and polite.

Hope that was of some use.
[\Quote]

Uh that is explained in the last year of school (GCSE's) under the Vector or with the quadratics when working with y axis cuts....

But in reality its quite logic.
Yes glTranslate,Rotate,Scale all apply only to the Polygons not to the camera but..
Translating the Camera is the same as inversly translating the world
ie
glTranslate(-cam) // translates all polygons the cameras negative position
// now because of relativity we can say that the correct polygons move towards the camera or the camera moves towards the polygons

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!