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 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).

share|improve this question

1 Answer 1

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

share|improve this answer
    
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. –  Ash Blue May 27 '13 at 19:06
    
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. –  Ash Blue May 27 '13 at 22:44

Your Answer

 
discard

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.