i am trying to build a tower defense game from First person view,i tried using maths for spawning actors in grids

but it doesnt works correctly,i dont know why

should i use a volume instead of maths ?

i am trying to build a tower defense game from First person view,i tried using maths for spawning actors in grids

but it doesnt works correctly,i dont know why

should i use a volume instead of maths ?

This is some very simple math, the reason your setup is not working is that rounding is rounding in a range of 1, let me make a macro for you that will input a vector and output a rounded number for a grid:

This macro will input a vector, and a multiplier (spacing between grid placements in your case), and it will output a rounded vector (rounded to the nearest multiplier that you inputted), and it will also output a Bias to the upper round, the bias vector will help tell you the bias of your vector to the nearest grid placement area, here is an example:

If I round 487 to a multiple of 100, the rounded vector will be 500, but the bias vector will be 87, which means your vector was 87% of the way to it’s round. Another example:

If I round (123x, 167y, 220z) to a multiple of 50, the rounded vector will be (100x, 150y, 200z), and the bias vector will be (46x, 34y, 40z), which represents 46%, 34%, and 40%.

If you have any questions about this macro, just ask, I know it may look like a lot, but it should only take you 2 mins to replicate it.

Nowhere, that is just for your own convenience in case you want to know the original location’s % between grid spaces. By the way, the Grid Size/Multiplier input needs to be how many units are between each grid space, not the grid’s actual size as in width/height.