A* Pathfinding Project  3.6.8
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
NavmeshAdd Class Reference

Adds new geometry to a recast graph. More...

Detailed Description

Adds new geometry to a recast graph.

This component will add new geometry to a recast graph similar to how a NavmeshCut component removes it.

There are quite a few limitations to this component though. This navmesh geometry will not be connected to the rest of the navmesh in the same tile unless very exactly positioned so that the triangles line up exactly. It will be connected to neighbouring tiles if positioned so that it lines up with the tile border.

This component has a few very specific use-cases. For example if you have a tiled recast graph this component could be used to add bridges in that world. You would create a NavmeshCut object cutting out a hole for the bridge. then add a NavmeshAdd object which fills that space. Make sure NavmeshCut.CutsAddedGeom is disabled on the NavmeshCut, otherwise it will cut away the NavmeshAdd object. Then you can add links between the added geometry and the rest of the world, preferably using NodeLink3.

Public Types

enum  MeshType { Rectangle, CustomMesh }
 

Public Member Functions

void Awake ()
 
Bounds GetBounds ()
 
void GetMesh (Int3 offset, ref Int3[] vbuffer, out int[] tbuffer)
 
void OnDestroy ()
 
void OnEnable ()
 
void RebuildMesh ()
 

Static Public Member Functions

static List< NavmeshAddGetAll ()
 Returns a list with all NavmeshAdd components in the scene.
 
static List< NavmeshAddGetAllInRange (Bounds b)
 Get all active instances which intersect the bounds.
 

Public Attributes

Vector3 center
 
Mesh mesh
 Custom mesh to use.
 
float meshScale = 1
 
Vector2 rectangleSize = new Vector2(1,1)
 Size of the rectangle.
 
MeshType type
 
bool useRotation
 Includes rotation in calculations.
 

Static Public Attributes

static readonly Color GizmoColor = new Color(94.0f/255,239.0f/255,37.0f/255)
 

Protected Attributes

Transform tr
 cached transform component
 

Properties

Vector3 Center [get]
 

Static Private Member Functions

static void Add (NavmeshAdd obj)
 
static bool Intersects (Bounds b1, Bounds b2)
 True if b1 and b2 intersects.
 
static void Remove (NavmeshAdd obj)
 

Private Attributes

Bounds bounds
 
int[] tris
 Cached triangles.
 
Vector3[] verts
 Cached vertices.
 

Static Private Attributes

static List< NavmeshAddallCuts = new List<NavmeshAdd>()
 

Member Enumeration Documentation

enum MeshType
Enumerator:
Rectangle 
CustomMesh 

Member Function Documentation

static void Add ( NavmeshAdd  obj)
staticprivate
void Awake ( )
static List<NavmeshAdd> GetAll ( )
static

Returns a list with all NavmeshAdd components in the scene.

Warning
Do not modify this array
static List<NavmeshAdd> GetAllInRange ( Bounds  b)
static

Get all active instances which intersect the bounds.

Bounds GetBounds ( )
void GetMesh ( Int3  offset,
ref Int3[]  vbuffer,
out int[]  tbuffer 
)
static bool Intersects ( Bounds  b1,
Bounds  b2 
)
staticprivate

True if b1 and b2 intersects.

Note
This method ignores the Y axis
void OnDestroy ( )
void OnEnable ( )
void RebuildMesh ( )
static void Remove ( NavmeshAdd  obj)
staticprivate

Member Data Documentation

List<NavmeshAdd> allCuts = new List<NavmeshAdd>()
staticprivate
Bounds bounds
private
Vector3 center
readonly Color GizmoColor = new Color(94.0f/255,239.0f/255,37.0f/255)
static
Mesh mesh

Custom mesh to use.

The contour(s) of the mesh will be extracted. If you get the "max perturbations" error when cutting with this, check the normals on the mesh. They should all point in the same direction. Try flipping them if that does not help.

float meshScale = 1
Vector2 rectangleSize = new Vector2(1,1)

Size of the rectangle.

Transform tr
protected

cached transform component

int [] tris
private

Cached triangles.

MeshType type
bool useRotation

Includes rotation in calculations.

This is slower since a lot more matrix multiplications are needed but gives more flexibility.

Vector3 [] verts
private

Cached vertices.

Property Documentation

Vector3 Center
get

The documentation for this class was generated from the following file: