I didn’t know how to title this. What I’m trying to do is create a mathematical grid based on world vector positions.
let me try and explain what I mean and am trying to do the best I can
I have a basic set up with two for loops to generate the grid vector2D.Then I have the tile size lets say 100.
so what I’m trying to do is create an array of world vector positions of the mathematical grid(no meshes at all just the math of a grid) now I already have the array set up so each theoretical tile has a world position space by the cell space that’s all fine and all but the vector coords of each theoretical tile is directedly in the middle of each tile space and that’s expected obviously. but my problem I need to solve is how do I get the boundary coordinates of each theoretical tile. I assume it would be current tile position + or - Tile size /2 in each direction. but what is the best way to use a mouse trace and on hit know what theoretical tile the hit was in?
I hope explained that well enough for someone to understand what I’m trying to do.
I already made a nice grid system with instances. problem is the scalability and I would like to do it this way because i want to learn how to do it and learn the math behind it. it would make for a really nice system if this is possible.
the instance grid above is what I made in a different project works find for something simple but I want to generate a grids math and store that information so I don’t need to use the tiles. I want to be able to use a single mouse hit and know where I am in my grid coords.
I thought of a by getting a for loop on each grid point and getting the vector points with in the bounds and store that in a struct map of each tiles vector location but theres got to be an easier way i am missing.
I think you’re taking a ‘procedural’ approach to the problem, one algorithm to manage all the tiles. Which is the hard way to do things.
You have enough here to place the tiles. If you make the tiles instances of a blueprint, then you can project from the mouse to the tile, or line trace, and the tile can deal with the rest.
Worked like a charm. i have over 1 million cells in the grid with no hit to performance and able to get the cell on mouse trace. thank you for the help
Ok, sorry, I didn’t know what level you were working on.
I don’t think you need any loop.
If you want to do it purely mathematically, as long as you know where the origin of the tile grid is, when the mouse is clicked ( and you have a world location ), you can work out which tile it would be ( having no tiles ), just by dividing the distance from the origin by the tile size.
That’s basically it, although it might be a bit more of a headache that that.