# Radius Modifier in XY space

Hi,

Is it possible to use the Radius Modifier in 2D, XY space? The documentation states that “This modifier assumes all paths are in the XZ plane (i.e Y axis is up).”

My game is 2D on XY axis and the Astar Path is rotated 270 degrees around the X axis.

Hi

Not out of the box. But I guess it shouldn’t be that hard to modify it so that it works in XY space.

Riku, did you manage to get this to work? I tried it and it caused the following to happen. Which is the exact opposite of increasing the wall-avoidance radius.

I wish I knew what I was doing

I have converted all of the .z into .y … but somehow it doesn’t smooth or warp as expected.

Hi

The easiest way is to do this:

Right at the start of the Apply method

``````for (int i = 0; i < vs.Count; i++) vs[i] = new Vector3(vs[i].x, vs[i].z, vs[i].y);
``````

and the same code right at the end of the Apply method (before ‘return res;’)

``````for (int i = 0; i < vs.Count; i++) vs[i] = new Vector3(vs[i].x, vs[i].z, vs[i].y);
``````

That will effectively first transform it to XZ space, run the modifier and then transform it back into XY space.

Hello,

I tried the code above but it doesn’t seem to work.
I thought it was an error and changed the last line to :
`for (int i = 0; i < res.Count; i++) res[i] = new Vector3(res[i].x, res[i].z, res[i].y);`
It’s better but it doesn’t give me anything good, and I keep getting “Could not resolve radiuses, the path is too complex.” for any value greater than 1.

Can someone help ?

Hi

Could you post a screenshot of what your results are?

Sure, here is the result with this at the end of the Apply method :

for (int i = 0; i < res.Count; i++) res[i] = new Vector3(res[i].x, res[i].z, res[i].y);
return res;

https://i.imgur.com/lQcbiKg.png

Sorry need to split my post because “new users cannot post more than one image…”