Live progress #14 – tile picking

With a help from Jery now we have a precise tile picking algo and a nice debug visualization of it, showing the bounding boxes underneath:

2014-05-04 terrain bounding boxes

We split terrain into quadtree of bounding boxes. When we need to pick a tile below the cursor, we first check bounding boxes and discard those that don’t intersect with the picking ray (cast from cursor position). That way we effectively discard 95% of tiles and hittest only remaining few inside the hit bounding boxes. On the screenshot that is the smallest purple box around the cyan picked tile.

This entry was posted in How things work, Live progress. Bookmark the permalink.

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.