Class RecastMeshObj Extends VersionedMonoBehaviour
Explicit mesh object for recast graphs.
Adding this component to an object will make sure it is included in any recast graphs. It will be included even if the Rasterize Meshes toggle is set to false.
Using RecastMeshObjs instead of relying on the Rasterize Meshes option is good for several reasons.
Rasterize Meshes is slow. If you are using a tiled graph and you are updating it, every time something is recalculated the graph will have to search all meshes in your scene for ones to rasterize, in contrast, RecastMeshObjs are stored in a tree for extremely fast lookup (O(log n + k) compared to O(n) where n is the number of meshes in your scene and k is the number of meshes which should be rasterized, if you know Big-O notation).
The RecastMeshObj exposes some options which can not be accessed using the Rasterize Meshes toggle. See member documentation for more info. This can for example be used to include meshes in the recast graph rasterization, but make sure that the character cannot walk on them.
Since the objects are stored in a tree, and trees are slow to update, there is an enforcement that objects are not allowed to move unless the dynamic option is enabled. When the dynamic option is enabled, the object will be stored in an array instead of in the tree. This will reduce the performance improvement over 'Rasterize Meshes' but is still faster.
If a mesh filter and a mesh renderer is attached to this GameObject, those will be used in the rasterization otherwise if a collider is attached, that will be used.
Public Methods
Bounds completely enclosing the mesh for this object.
Public Static Methods
Fills the buffer with all RecastMeshObjs which intersect the specified bounds.
Public Variables
Voxel area for mesh.
Check if the object will move.
Surface rasterization mode.
If true then the mesh will be treated as solid and its interior will be unwalkable.
Voxel area for mesh.
Public Enums
Private/Protected Members
Dynamic objects are stored in a list since it is costly to update the tree every time they move.
Handle serialization backwards compatibility.
Recalculates the internally stored bounds of the object.
Handle serialization backwards compatibility.
Static objects are stored in a tree for fast bounds lookups.