Download

How do I create a circular rts grid?

Like something like this:

f754155d7b32583367a4228fe13e158b653ef7a0.jpeg

done in blueprint, If you could point me to some reading to do i’d be grateful. I’m not even sure where to start from to be honest ! thank you for your time !

Your question is a little vague to me, but maybe this will be useful to you in someway - I had made a function for converting polar coordinates to cartesian for doing polar grids like that.
The function looks like this:

b16568cf5924736c687a96585ecc012a6aa08ebe.png

This is for 3 dimensions obviously, but you only need two, so you would just set theta to 90, for this function.

It could be used as below, to generate points on your polar grid. You have control of the number of sides, the spacing of the rings, and the initial radius to offset, like in your image actually.

3d8d922fd1908fa2e5d431f5ceaf25733939b84e.png

Just to demonstrate what that does, you could draw the grid using debug lines like this:

3385091f4aeb043c9fcbf98df87a80cb3f9c03fe.png

And the result:

a10b6a8798ba919f17a23b3e3f50ec2fdd7c131a.png

If you want to snap things to a polar grid, you could generate the points like that once, and store them in an array.

Thank you! I wasn’t expecting such a detailed reply. What you posted is what i meant even if I don’t know what that “3Dpolar to cartesian” that you use a couple of times is.

Yep thatš just a custom function, it makes it easier to draw a polar grid, it could be done with regular coordinates but it would be more complex.

Worked like a charm. Thanks ! How would you go about storing the points once in an array ? Is there a way to store this information in the default values of the vector array ?

Well, in that first picture, the Grid Coordinates is just an array of vectors, but it has to be generated on construction. That should be fine though, I’m not sure of anyway to have it pre-set without generating them at runtime. I suppose if you really wanted to you could print all the values and manually enter them in the array heh.

It depends what you want to do with them, for most purposes storing them like that should work, you could make a function out of that entire thing and just call it on construction. Just be careful that nothing attempts to access the array before it has been filled

If I can’t find a better way I guess I could manually enter them, it’s a non issue there. I want to use the points to create an interactive grid so either spawn meshes pointing towards the center or working on a similar way in UMG. The end goal is making a prototype of a rtsesque sort of game but using that as a grid :slight_smile: In the first attempt to create this I used a blueprint for each grid component, in long run that was a bad idea haha