omg

Started by
5 comments, last by dawidjoubert 18 years, 10 months ago
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 :/
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 ;)
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;
Grats.
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: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 :)

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
----------------------------

http://djoubert.co.uk

This topic is closed to new replies.

Advertisement