Table of Contents

Recast Generator

This script is a tool for creating a navigation grid by way of a recast-like algorithm. The generated navgrid file can then be used by an AI's path manager.

A GameObject with the component can be automatically created going to RAIN→Recast→Create Recast Object.

Properties

  • Recast Option - Has two values: “Use Recast Object” and “Use Recast Distance”. A Recast Object field will appear if “Use Recast Object” is selected. A Recast Distance field will appear if “Use Recast Distance” is selected.
  • Recast Object - Takes a GameObject whose bounds will be used as the limits of the scene to be recast.
  • Recast Distance - Defines the size of a square area in meters that will serve as the area to be recast. The center of this square is the position of the GameObject that the component is attached to.
  • Max Slope In Degrees - The value in this field represents the maximum slope angle in degrees that should be considered walkable. For example, if a value of 30 is entered, objects with a walkable Y axis slope greater than 30 degrees will be marked as unwalkable during the Recast analysis.
  • Cell Size - This value indicates how large individual cells should be. Cells should generally be approximately the same radius as the AI that will be walking the graph. Smaller cell size will produce a more detailed graph, especially near collidable geometry, allowing the AI to walk closer to objects. Larger cell sizes will conserve memory and reduce computational overhead in pathfinding.
  • Cell Merge Height - This value indicates the minimum gap between geometry that overlaps in the Y axis that should be considered separate. This is used to determine whether to merge smaller crevices, overhangs, and other vertical gaps. This height should generally be slightly larger than the AI height.
  • Cell Step Height - This value indicates the maximum height between two adjacent cells, above which they should not be considered walkable neighbors. For example, if an AI can step up from a street onto a curb, the step height should be above the curb height. This value is generally set to the AI step up height in the Character Controller.
  • Minimum Region Size - The Recast system segments the Nav Grid graph into walkable regions. Regions are created when there are walkable “islands”, or areas that can’t be reached from surrounding areas. Regions are also created when geometry overlaps, for example with a bridge over a valley, even though the areas may be separate. Certain game objects (lamp posts, vehicles, etc.) may produce small regions that should not be considered walkable.If the truly navigable areas are fairly large, you can cull extraneous regions by setting a minimum region size to a value larger than the number of cells in the smaller regions, but less than the number of cells in the larger walkable areas. Use the Recast visualization system to determine if there are smaller regions that can be culled to improve performance.
  • Show Recast Mesh - Check this box to add visualization information to your scene indicating which geometry is being included in the Recast analysis.
  • Show Span Mesh - Check this box to add visualization information to your scene showing the cell-by-cell spans that define the walkable graph. This visualization is useful for determining connectivity (arrows indicate which cells can be reached from adjacent cells) and to view how the navigation graph is overlaid on the scene. Black arrows indicate neighbor connections within a region. Red arrows indicate neighbor connections across region boundaries.
  • Show Region Mesh - This pullout contains a list of regions calculated during the Recast process. Click the Show All button to show all regions, or select individual regions to show the connectivity graph for the regions.
  • Tags to Ignore - This is a list of GameObject tags representing objects that should be ignored by the Recast calculation. All objects with tags that match any tag in this list will be ignored. By default, the “EditorOnly” tag is ignored.
  • Tags to Mark Unwalkable - This is a list of GameObject tags to mark as unwalkable. All objects with these tags will be excluded from the walkable area of the navigation grid.
  • Layers to Include - This is a list of layers that should be included by the Recast calculation. Uncheck the boxes next to layers that should be ignored. It is often helpful to create a custom layer called “ignoreRecast”, which should be unchecked, that can be applied to objects that should not be included in the Recast analysis.
  • Navigation Grid Filename - The name of the file to save the generated Navigation Graph to when Save Navigation File is clicked. Note that you only need to enter a name like “NavGraph” without a path or extension. RAIN{one} will manage the location and file extension of the generated file. This Filename is only used when the Save Navigation File button is clicked, and should match the name of the Nav Grid File specified in your individual AI’s PathManager.
  • Refresh Recast - Clicking this button will update the Recast calculation based on any changes you make to the above fields. The resulting navigation grid will be saved out to a file.

Usage

unitycomponents/recastgenerator.txt · Last modified: 2022/09/05 14:02 by sigil