Wednesday, January 6, 2016

Unreal Engine Tips & Tricks #11: Nav Mesh Configuration

1. The Recast NavMesh has a couple of attributes named 'CellSize' & 'CellHeight' under the 'Generation' section in it's details panel. Together they determine the resolution of the nav mesh & lowering these values can create more precise nav meshes. It could be especially useful when there are lot of holes in the nav mesh due to the surface properties of the terrain. However, lowering them also makes the nav mesh calculations more expensive.

2. If runtime nav mesh generation is enabled, it would be best to set the 'Tile Size' attribute of Recast NavMesh to the minimum viable amount.

3. The 'Min Region Area' parameter which can also be found under 'Generation' section of Recast NavMesh can be increased to get rid of small nav mesh islands that are isolated from the rest of the nav mesh regions.

4. When moving around objects that can influence the nav mesh with the runtime nav mesh generation enabled, it is far more efficient to use the actors as dynamic obstacles (with custom nav area settings) when compared to moving around actors in their default state. For static meshes this can be done from the static mesh editor as shown:

Just tick the 'Is Dynamic Obstacle?' checkbox & set the nav area type from the dropdown right above it. 

Alternatively, the same can be set up from the collision components in actor classes as shown below: [same procedure as mentioned in the static mesh editor workflow]

5. If you have tall characters in your game that are having issues with the nav mesh pathing, go to 'Navigation System' category under Project Settings. Add a new 'Supported Agents' & then try increasing the z value of 'Default Query Extent' of the new agent.

On the other hand, in order to create separate nav mesh pathing for the bigger AI characters, add a new element to 'Supported agents' array & specify custom agent radius, query extent, agent height, etc. Build paths again to see a new nav mesh recast in the Scene Outliner tab. The 'Enable Drawing' parameter under Recast Navmesh can be ticked On to visualize the new nav mesh. It seems that the navigation system will automatically determine which agent type is suitable for the bot based on it's collision capsule size.

[Source: Unreal Engine 4 AI Support Twitch Broadcast with Mieszko:]