Support Forum

How do i offset walkable nodes on the preview

i have already managed to make an offset to the non-walkable nodes in my game using this:

        if (((float)gridNode.position.z / 1000f % 2f) == 1f)
        {
            gridNode.position = new Int3(gridNode.position.x - (1500), gridNode.position.y, gridNode.position.z);
        }

because my tiles in my hexagonal game are 3 units tall and i actually don’t know how to change that, didn’t write the code myself.

BUT the walkable nodes don’t change position. they just stay in the original position like this:
image
and that’s a problem.

how would i fix this?

Hi

You can’t modify the position of the grid nodes using code. The grid graph assumes they are laid out in a particular pattern.

However, with some math you should be able to use the “Advanced” shape mode of the grid graph to create this pattern.

If you set

shape = Advanced
rotation = (0, 45, 0)
node size = 3 * 1.5/sqrt(2) = 3.181980515339464
isometric angle = acos(2/3) = 48.214 degrees

then you should get the shape you want. I.e. a hexagon which is exactly 3 units wide and 3 units tall.

well, i managed to do what i wanted, but that’s even better! thank you!

1 Like