1
\$\begingroup\$

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

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

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

\$\endgroup\$
2
  • \$\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
    Commented May 27, 2013 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
    Commented May 27, 2013 at 22:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .