Layered Grid graph seems offset

Hello, I’m trying to get a Layered Grid Graph set up in a test scene and I’ve mostly been able to configure it, but I’m noticing that on the upper portion of the walls/platforms that it seems like it’s not quite aligned.

Do the objects need to be aligned with nodes? For a little context, the walls in the image are using a Mesh Collider; they are just for testing as I would probably switch them to a box collider. Don’t know if it makes a difference.

Hi

The layered grid graph will use a raycast downwards to determine where it is able to place nodes. In your case it looks like it just hit the objects on the closer edge, but it just missed them on the far edge.
Aligning the objects with the grid can make things look neater, but it’s not strictly necessary. However if you do not align the objects with the graph, you may need a slightly higher resolution of your grid.

Thanks Aron,

I was about to try increasing the grid resolution a little, but had another quick question.

Looking again at the “Collision/Height Testing” section of the Layered Grid Graph component, are those the parameters used for the Ray? I think I had assumed they were meant to mirror my CharacterController dimensions so went with those values.
If that is the case, I’m sure it would make more sense to set some sensible values just for the sake of environment scanning?

Hi

The grid graph settings and the movement script/character controller settings are completely independent, but usually use pretty similar values. Often you have some additional margin when generating the graph, to make the agent not hug walls quite as much.

1 Like