Skip to main content
GameDev.net gamedev.net
🔒 Locked

Finding covered tiles of the brush

Started by oenda Nov 29, 2014 at 9:44 PM 0 replies 2.7k views
Original Post
oenda
oenda

I need to calculate terrain brush covers how much tiles.And i need to find which tiles has been selected.I use hexagonal tiles.When brush size changed,covered area size changes.

I need an algorithm for this problem.

I looked to this site : http://www.redblobgames.com/grids/hexagons/ But i couldn't understand.

Thanks in advance.

for example:

[attachment=24833:pic1.jpg]

my editor :

[attachment=24834:pic3.jpg]

Muzzy A
Muzzy A

Not an expert on this or anything, but no one else has replied so I will put in my opinion =P

From what your saying it seems like I would personally do something like casting a ray from the camera and get the point of collision on the terrain from that ray. Then create a vertical cylinder, rectangle, or whatever the shape will represent your brush the best, then test that geometric shape against the terrain to find all of the tiles that are either inside or colliding with the shape.

Hope this helps!

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.