1
\$\begingroup\$

I am implementing Theta* pathfinding in a tile-based 2D game. A tile is either blocked or unblocked. The character has a rectangle collider with a width and height in tiles. Is there an algorithm for finding all the tiles the rectangle will overlap when moving in a straight line from A to B on the tile grid?

\$\endgroup\$
1
  • 1
    \$\begingroup\$ One possible solution is presented here. The final version there works with a circle, but the first step approximates the circle as a rectangle, so you can use that rectangular version to solve your problem \$\endgroup\$
    – DMGregory
    Jan 1 at 14:43

Your Answer

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

Browse other questions tagged or ask your own question.