Large Terrain with Structures graph question

Hello!

My game utilizes a large terrain (open world) with structures sprinkled throughout.
I am considering using a Recast Graph for the terrain but I am uncertain how to get pathing set up within the structures.

What I am looking for is for the graph to allow for entrance into a structure - through a doorway and then confine the path to the structure interior, including stairs, hallways, etc. without allowing the pathing object to go through walls and such.

I can get the graph to recognize the structure as an obstacle but I can’t figure out how to get the graph to propagate into the open doorway and up the stairs, into rooms, etc.

Can I use mesh colliders for the structures or do I need to add colliders that use the obstacle layer?

Any and all help is appreciated.

Hi

Most likely the resolution of the graph is too low. Check the ‘cell size’ field of the recast graph.
You can use mesh colliders, or even just the rendered meshes if you check ‘rasterize meshes’ in the recast graph settings. If your world is large I recommend just rasterizing colliders though, for performance reasons.

An easy way to see how the graph has been rasterized is to set the ‘Max Edge Error’ setting on the recast graph to zero (you should not do this in your final game though).
If you post a screenshot of the building and mesh

Thank you for the information!

Question on how to set up the houses:

Should I add a mesh collider to the house object and set its layer to obstacle?
Should I set up colliders and set their layers to obstacles and set the house object layer to walkable surface?

I’d like the mob to enter the house but not be able to walk through walls. :slight_smile:

Thanks!

Hi

If you have a recast graph, there is no distinction between obstacle layers and ground layers. It treats everything as the same geometry.
(well, you can force it to make some surfaces unwalkable using the RecastMeshObj component, but usually you don’t have to use that).

If you can I would recommend only using colliders (and disabling ‘rasterize meshes’ in the recast graph settings) as for a large world, the extra performance impact of having to use meshes (which are usually very detailed) instead of colliders (which are usually very simple) can be quite significant. You can just use the house mesh if you want though, especially for prototyping it is very efficient.