Class RecastMeshObj Extends VersionedMonoBehaviour

Public

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

GetBounds ()

Bounds completely enclosing the mesh for this object.

Public
GetCollider ()
Public
GetMeshFilter ()
Public

Public Static Methods

GetAllInBounds (buffer, bounds)

Fills the buffer with all RecastMeshObjs which intersect the specified bounds.

Public Static

Public Variables

bounds
Public
dynamic

Check if the object will move.

Public
mode

Surface rasterization mode.

Public
surfaceID

Voxel area for mesh.

Public

Public Enums

Mode
Public

Private/Protected Members

_dynamic
Private
Awake ()
Protected
dynamicMeshObjs

Dynamic objects are stored in a list since it is costly to update the tree every time they move.

Protected Static
OnDisable ()
Private
OnEnable ()
Private
OnUpgradeSerializedData (version, unityThread)

Handle serialization backwards compatibility.

Protected
RecalculateBounds ()

Recalculates the internally stored bounds of the object.

Private
Register ()
Private
registered
Private
Reset ()

Handle serialization backwards compatibility.

Protected
tree

Static objects are stored in a tree for fast bounds lookups.

Protected Static

Deprecated Members

area

Voxel area for mesh.

Public