LayeredGridGraph - Randomly leaving out walls

Hi there,

I’ve been using a layerdgridgraph for a while with good success, but lately I’ve noticed a few walls are not picked up as obstacles when scanning, wheras the rest of my scene walls are working fine.

All the walls in my scene are marked as obstacles and either have a mesh collider or box collider attached to them. This is the case for all my walls. However, two of them that I’ve recently added just don’t seem to be picked up when I do a graph scan.

Here all the walls in question. Notice how the grid graph just continues through the walls for whatever reason.

Here’s another place it ignores it. There are stairs behind this, hence the slanted graph in a few places (obviously shouldn’t be going through the wall).

For now, I’m just throwing some empty game objects with colliders in front of them so that scan can at least put something there, but I’m hoping that is just a temporary solution.

Any thoughts?

Hi

What collision mode are you using? I would recommend using the Capsule or Sphere mode with a diameter larger or equal to 1.5.

Right now it looks like I’m using whatever the default was – Capsule at a diameter of 0.5

After bumping it up to one, it seems to be working! Do you mind explaining what exactly this setting does? Does it use the Capsule as like an stand-in of the agent that would be pathing through? By stand-in I mean like using a capsule collider to figure out the graph pathing areas while scanning.

Hi

What it does is basically just placing a capsule on top of the node with a diameter of [0.5 * the node size] and checking if it collides with anything. With a diameter of 0.5, it wouldn’t cover the whole node, so there would be a possibility of it missing walls.
It isn’t actually creating a capsule though, it uses the UnityEngine.Physics API.

1.0 is the default value, so you must have changed it somehow.

To get full coverage of a node, you would need to set it to sqrt(2) ≈ 1.41, but it tends to be a bit conservative in some cases, so 1.0 is the default, which covers almost all cases.

Great, thanks! Yeah, I must’ve changed it the first time I used it and never looked at it again haha.

I appreciate the explanation. Sorry it was something that could’ve been avoided by just leaving it on default. :stuck_out_tongue: