#Detecting collision between tilemap and a rectangle
1 messages · Page 1 of 1 (latest)
you mean tile map layer right?
the tile map node is deprecated fyi
okay so what you need to do is get the tile size inside the TileSet property of the tilemap(see docs)
than loop over the get_used_cells() method , and check if they are present inside the rectangle
if you need info about implementation tell me
How do I check if they are inside?
you want to check if they are fully inside or only partily
Was thinking partially. But fully is also a good option.
So far didn't test it but was thinking about checking if rectangle values (when it's dragged) are dividable by tile size, then drawing lines from those points and by that getting point cords on which to check if there are tiles there.
So like creating a mesh inside rectangle that'll then pick all tiles to select.
is your tile set completly filled??
it really depends on what your going for
for something that always works you can loop as i suggeste
Yup, completely filled. I want to do what Rect Tool does in the editor, but in game.
checking if a rect collides with another is as simple as checking if atleast on corner is inside of the rect(tile)
if you need more clarifycation tell me
or if i missunderstood your goal
also english isn't my first language so sorry
I want to do this, not in editor, but in game
oh
the tiles are isometric
but its filled
so its easier
lets do it like this
implement a function that checks if a tile is inside a rect
Would this solution work?
i am not sure if its efficent