Skip to main content
gamedev.net
🔒 Locked

Camera in 2D

Started by Kris2456 0 replies 300+ views
Original Post
Kris2456
Kris2456
Hi, Is it possible to implement a camera such as gluLookAt() in a 2D game. I tried it, but it messed up. What i am trying to do, is have the camera follow a tank that is driving on a 2D landscape viewed from the top. thx
------------ "Here lies a toppled God,His fall was not a small one,We but built his pedastle,A narrow, and a tall one" Frank Herbert (Dune:Messiah)
Gorax
Gorax
All you need to do is translate to the negative position of the tank, and draw the tank at 0,0.

//assuming you're using the x and y planes:glTranslated(-tank->position.x,-tank->position.y,0);//draw the world as normal...//draw the tank at 0,0...


There's no real need to make it any more complex than this.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.