Recast with obstacles

Just installed A* and migrating our project over from Unity’s NavMesh.

Total noob question: how do you flag something as an obstacle when using a recast graph? I see that using a grid graph lets you set a layer for colliders but such an option doesn’t exist for the recast graph.

I can of course just exclude a particular layer from the layer mask but that doesn’t really address the issue since the pathfinding will then ignore the object rather than treating it as an obstacle.

Thanks!

Hi

You have a similar layer mask in the Recast Graph settings. It specifies what is considered obstacles. Note that unless you have Rasterize Colliders enabled (hm, has that trickled down to the released version yet… it might only exist in the Experimental Version), it will only rasterize objects which have a MeshFilter/Renderer attached.

Recast will automatically tell what is walkable and what is not from the settings. There is no way to explicitly set what is an obstacle (i.e unwalkable surface) in the current version. You can however check out the Experimental Version and try the RecastMeshObj (check experimental version documentation, see download page). With that component, you can explicitly mark an object as an obstacle.

Hi

Unlike grid graphs, which usually divide objects into walkable objects and obstacles, recast graphs usually do not make that distinction (see my previous post for an exception when using RecastMeshObj). Recast graphs will just take a polygon soup (that is, all your meshes) and calculate the walkable area from that.

If the above does not make any sense, could you please provide a screenshot or similar to explain the context?

Okay thanks, I’ll check out the experimental build :slight_smile:

For the recast graph, there is only one field for the layer:

…which is the layer(s) to be used for navmesh. I don’t see any field to specify an obstacle layer.