This is the idea:
Create a "bounding box" (orange) around the camera (blue), snap that bounding box to the grid on all sides (moving outwards, in all directions from the bounding box, until you hit a grid line - green). Then just divide the corners of the green square by tilesize, you should end up with actual grid array element positions to fetch tiles with.
There's a little slop when the camera is rotated (you'll pick up extra tiles you don't really need to draw & update) but, on the other hand, you don't have to scan around or perform any intersect tests, so hopefully the net result is reasonably quick.
If this doesn't work I'm screwed, because I can't think of any other way to do it! Now I just have to write it...
Update: I got about half way through it this evening and figured I'd run it just to see what happens. Here's some "unexpected results" for you:
direct link
Yea it's not quite done yet :)
12/12/07
2D Camera
by
emachine74
@
9:01 PM
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment