A* Pathfinding Project
3.8.7
The A* Pathfinding Project for Unity 3D
|
Adds new geometry to a recast graph. More...
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< NavmeshAdd > | GetAll () |
Returns a list with all NavmeshAdd components in the scene. | |
static List< NavmeshAdd > | GetAllInRange (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< NavmeshAdd > | allCuts = new List<NavmeshAdd>() |
enum MeshType |
|
staticprivate |
void Awake | ( | ) |
|
static |
Returns a list with all NavmeshAdd components in the scene.
|
static |
Get all active instances which intersect the bounds.
Bounds GetBounds | ( | ) |
|
staticprivate |
True if b1 and b2 intersects.
void OnDestroy | ( | ) |
void OnEnable | ( | ) |
void RebuildMesh | ( | ) |
|
staticprivate |
|
staticprivate |
|
private |
Vector3 center |
|
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.
|
protected |
cached transform component
|
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.
|
private |
Cached vertices.
|
get |