I have a game template I am working on where the user can place tiles and build the terrain. I have a mathematical grid set up to determine what “Tile” the cursor is in based on cursor location. Grid system and everything works perfectly, and I always know that my cursor is over say XY Tile ( 2D Coordinates) What I am having an issue is creating a drag select area and place tiles in the selected area.
I made a working mode by making a temp grid from the start drag location on LMB pressed and on tick updating the end drag location and it can easily draw all the tiles in the area. the issue arises when you make a bigger area as on tick it is constantly recalculating the temp grid and as it gets bigger and bigger the tick event becomes more of a bottleneck.
I assume there is a much easier way for me to simply use a start and end location and get all coordinates inside in an optimized way instead.
Any insight on some math where i can easily get all coordinates in a box would be amazing
If you make a BP containing a box collision volume, when the player drags, spawn this BP and scale the collision volume to the dragged area. Then, finding the tiles is as easy as
Well my issue is I am working with no collisions just the math of it in empty space so that the player could then simply drag over an area and let go and then spawn the tiles for all points within the area