none
Isometric Collisions RRS feed

  • Question

  • Hey everyone,
    I'm making my first isometric game and I'm having a bit of trouble with smooth collision. Since all of the tiles are essentially drawn diagonally to the plane, I want a wall that has a diagonal collision. However, all I have to work with is rectangles. Currently I have kind of a staircase effect while what I want is a smooth diagonal wall.

    I heard some talk of a buffer to the rectangles but all my search attempts have been fruitless. Any help would be much appreciated. Also, let me know if you want specific samples of my code, but all I really need is to be steered in the right direction, maybe some example code to help me out.

    Thanks in advance!
    Matt

    Thursday, November 3, 2011 3:51 PM

Answers

  • Don't base your collisions on the graphics.  Whether it is isometric or not is irrelevant.  You should have some data structure that models the game board and all the objects in it (player, monsters, obstacles, etc.).  Each object would have a corresponding size, location, etc.  Base your collisions on that data.  The only time the isometric part should come into play is during the display.  In other words, keep the display and the game data separate.  This is the principle of "Separation of Concerns"
    • Proposed as answer by CS001 Thursday, November 3, 2011 8:47 PM
    • Marked as answer by Bob Wu-MTModerator Wednesday, November 16, 2011 6:47 AM
    Thursday, November 3, 2011 7:55 PM

All replies

  • Don't base your collisions on the graphics.  Whether it is isometric or not is irrelevant.  You should have some data structure that models the game board and all the objects in it (player, monsters, obstacles, etc.).  Each object would have a corresponding size, location, etc.  Base your collisions on that data.  The only time the isometric part should come into play is during the display.  In other words, keep the display and the game data separate.  This is the principle of "Separation of Concerns"
    • Proposed as answer by CS001 Thursday, November 3, 2011 8:47 PM
    • Marked as answer by Bob Wu-MTModerator Wednesday, November 16, 2011 6:47 AM
    Thursday, November 3, 2011 7:55 PM
  • You know, I've seen this said in other ways before but I never really understood how to go about doing this. But with the way you said it, it suddenly it clicked into my head exactly what you mean, so thank you! I was able to correct all of my code and it works perfect now. Thanks!
    Thursday, November 3, 2011 10:12 PM