Create grid points spiralling outwards

Hello,

I’m using two for loops to spawn a grid of objects.

So one for-loop from 0-9 and within that loop another for-loop from 0-9 that spawns things and in the end creates a 10x10 grid. This is by using the indexes of each loop and feeding it into a function as x and y numbers that calculates where in the world I spawn my things.

This loop creates the gird points in this order: (0,0) (0,1) (0,2) (0,3) […] (9,7) (9,8) (9,9)

I want to change this such that I give a function a an x and y variable, i.e (4,5), and it goes through the grid spaces around this point in a spiral. So the grid is created from this point outwards rather than the way I have it now. I tried finding this answer in the mathematics stack exchange website but the answers seemed to be much more complex than I believe this problem requires and I wonder if there’s a simple way in Unreal/Blueprint.

Thanks,

Jack