Diameter and radius for grid and recast graphs don't seem to work properly

With the grid graph, increasing the diameter to 2 from 1, requires around 4 empty spaces to fit. When it should only require 2. Mayby 3 if theres some sort of aditional space buffer added.


why cant a 1.1 diameter agent fit through that entire maze?

The Recast graph is entirley inconsistent. 2 different identical “openings” (like a doorway) will be treated differently, with one being traversable with space to spare and with the other making the entire area around it non traversable. Edit: the door bit was my fault had an invisible collider ther ei forgot about.

Shouldn’t an agent with a radius of 0.5 Unity units fit through every square of the maze in the image? The grid is1x1 units., with the cubes being slighlty smaller.

Is there a setting to remove or lower padding? should i make the radius/diamater much smaller than the actual collider of the agent? should i scale everything up or use much smaller scale nodes?

A better recast example

For grid graphs, a collision check is done to see if an agent can stand at the center of each node. In your case, a 1.1 diameter circle will collide with the walls in most cases. I’m not sure why there are some places where it doesn’t seem to find the walls. Maybe they are moved slightly?
You’ll have to increase the resolution of the graph if you want a 1.1 meter agent to be able to walk through the maze.

The recast graph also has an internal resolution. That’s the voxel size in the inspector. This means that to the recast graph, the corridors may look like they are slightly narrower than 1 meter. Reducing the voxel size can make it approximate the sizes better, and will lead to a more accurate navmesh (at the cost of a higher time to scan ).

See RecastGraph - A* Pathfinding Project

If you need to, you can increase the resolution of the graph. But otherwise tweak the settings until it looks good. You don’t have to use the exact values that you use for the agent itself.

Decreasing node size has yielded some success. It does require a bit of trial and error to get apropriate node resolution and agent dimension combo. Making the agent dimensions about half the size of their actual collider gets me close to what i want.

You can consider this post Solved, thanks.

1 Like