Using the recast graph, I can’t stop the AI from walking up and over the edges barrels rather than around them. This does not happen when using a layered grid graph.
You can see from the screenshot barrels are excluded from the graph, so the AI should walk around them. However, they end up clipping the barrels as described
For both the recast and layered grid graph, I add this code:
Pathfinding.RaycastModifier raycastModifier = workingObject.AddComponent<Pathfinding.RaycastModifier>();
raycastModifier.raycastOffset = new Vector3(0, walkableCharacter.GetBodyHeight * .5f, 0);
raycastModifier.mask = LayerManager.aiPathBlockers;
raycastModifier.useGraphRaycasting = true;
raycastModifier.useRaycasting = true;
raycastModifier.thickRaycast = false;
raycastModifier.quality = RaycastModifier.Quality.Low;
For the raycast graph only, I add this code:
SimpleSmoothModifier simpleSmoothModifier =
gameObject.AddComponent<SimpleSmoothModifier>();
simpleSmoothModifier.iterations = 1;
The reason I add simple smooth modifier is otherwise all AI in the scene that start near each other take the same path rather than walk directly towards the target. Layered grid graph doesn’t have this same problem, so I leave it off.
How do I use recast graph, where all the units with a close proximity destination and origin take a direct path, but also do not clip and walk over barrels?