-
side scrolling camera following
hi 
i am making a 2d side scrolling platform game with the camera following the character while the platforms and obstacles move in relation to the character and camera.
I have been trying to use gluLookAt and gluPerspective but have had no luck with them.
Can some1 please give me some advice on the best way to make the camera follow the character.
Many thanks
Chris
-
Super Moderator
OpenGL Guru
Re: side scrolling camera following
Once you get things rendering correctly, use a glTranslate call on the modelview matrix before you draw the scene with the character.
glTranslate2f(-charpos_x, -charpos_y, 0.0);
As you can see this will conteract the character's translate and so the eye will track with the character.
You could just use the translate in the x axis to track the character horizontally and allow the character to move vertically on the screen depending on your level design.
-
Re: side scrolling camera following
Thanks very much mate.
it works a treat 
Chris
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules