Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm using the "Zig-Zag" approach to drawing my isometric map (as seen here http://stackoverflow.com/questions/892811/drawing-isometric-game-worlds). Now I need to do collision detection on the irregularly shaped map.

All I need to know is how to figure out if point (x, y) is colliding with the zig-zag isometric map.

share|improve this question
add comment

1 Answer

Hmm. You may be mixing up your game (control) logic with your rendering (view) logic.

There are a few ways:

  1. Grid-placement checks using the grid representing your world in your game logic. In the link you posted, this would be the abstract 2D (or 3D) grid you store in memory as array, that represents the city blocks. This would help in eg. a Sim City type game where you only need to know, "Can I put this here?" Useful for placement, but not so much for analog movement -- good for Chess, but not for PacMan.
  2. Logical grid checks as axis-aligned boxes PLUS circular collision checks. Here you can use your logical grid as a set of boxes which you can very easily check against one another; but you can also check them against circles representing mobile entities in your game eg. the player, cars on the streets, or whatever. This is simple to implement and very fast because no trig is required really, the only thing you use is overlap checks on the x and y axis (bounding box checks) and pythagoras for radius checks, and point-in-square checks.
  3. You may want pixel-perfect collision detection. If you do, do a search on it, you will find stuff on here, on gamedev.net forums, on gpwiki.org, all over in fact. It involves checking which pixels of one sprite overlap which pixels of another sprite, in a given rectangular region that represents the overlapping area of the 2 square bitmaps which constitute those sprites. Consider this only if you need a high degree of accuracy, for example in an action game with large, relatively slow moving sprites this might be useful. If your sprites are small and fast moving, check out option 2 -- it will be good enough!
  4. Use a physics engine like Box2D for collisions if you need really fast collision detection for a great many objects and once, i.e. most of your objects are not static.

If you use approach 1 or 2 or 4, then how you end up rendering after doing the logic I've outlined, is your choice entirely. It could be isometric, it could be top down, side on, full 3D, whatever. But generally there is a distinct difference between your actual world (which is just data) and how it is represented (which is usually just pixels). So don't let the fact that your world is viewed isometrically, confuse you -- it's still just a plain old grid. Do the collision checks on that grid, then worry about whether its isometric or not.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.