I have a tile based board game where units move in 3D space on a 2D isometric view. When calculating attack tiles for a unit, how do I verify that they aren't shooting through a wall or a level too high for them see. I need quickly verify a lot of these attack tiles are within a unit's range of sight (about 20). What's the fastest way I can verify line of sight with the x, y, and z axis?

Somebody posted a similar question here, but it covers 2D sight calculation instead of 3D (making the answer very different).


Use 3D DDA. It is the 3D version of 2D cell-based raycasting which you refer to.

| improve this answer | |
  • \$\begingroup\$ Pseudo code seems fairly easy to understand. To see the 3D code sample look under "The New Traversal Algorithm" section in the second code snippet. \$\endgroup\$ – Ash Blue May 27 '13 at 19:06
  • \$\begingroup\$ Okay, I think the PDF you linked to works. The problem is I can't figure out what tMaxX/tMaxY/tMaxZ and tDeltaX/tDeltaY/tDeltaZ are equal to. Document is a bit vague on how to get these values. \$\endgroup\$ – Ash Blue May 27 '13 at 22:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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