/// Navmesh cutting is used for fast recast/navmesh graph updates.
///
/// Navmesh cutting is used to cut holes into an existing navmesh generated by a recast or navmesh graph.
/// Recast/navmesh graphs usually only allow either just changing parameters on existing nodes (e.g make a whole triangle unwalkable) which is not very flexible or recalculate a whole tile which is pretty slow.
/// With navmesh cutting you can remove (cut) parts of the navmesh that is blocked by obstacles such as a new building in an RTS game however you cannot add anything new to the navmesh or change
/// the positions of the nodes. This is significantly faster than recalculating whole tiles from scratch in a recast graph.
/// The NavmeshCut component uses a 2D shape to cut the navmesh with. A rectangle and a circle shape is built in, but you can also specify a custom mesh to use.
/// [Open online documentation to see images]
///
/// Note that the shape is not 3D so if you rotate the cut you will see that the 2D shape will be rotated and then just projected down on the XZ plane.
///
/// In the scene view the NavmeshCut looks like an extruded 2D shape because a navmesh cut also has a height. It will only cut the part of the
/// navmesh which it touches. For performance reasons it only checks the bounding boxes of the triangles in the navmesh, so it may cut triangles
/// whoose bounding boxes it intersects even if the triangle does not intersect the extruded shape. However in most cases this does not make a large difference.
///
/// It is also possible to set the navmesh cut to dual mode by setting the <see cref="isDual"/> field to true. This will prevent it from cutting a hole in the navmesh
/// and it will instead just split the navmesh along the border but keep both the interior and the exterior. This can be useful if you for example
/// want to change the penalty of some region which does not neatly line up with the navmesh triangles. It is often combined with the GraphUpdateScene component
/// (however note that the GraphUpdateScene component will not automatically reapply the penalty if the graph is updated again).
///
/// By default the navmesh cut does not take rotation or scaling into account. If you want to do that, you can set the <see cref="useRotationAndScale"/> field to true.
/// This is a bit slower, but it is not a very large difference.
///
/// Version: In 3.x navmesh cutting could only be used with recast graphs, but in 4.x they can be used with both recast and navmesh graphs.
///
/// <b>Custom meshes</b>
/// For most purposes you can use the built-in shapes, however in some cases a custom cutting mesh may be useful.
/// The custom mesh should be a flat 2D shape like in the image below. The script will then find the contour of that mesh and use that shape as the cut.
/// Make sure that all normals are smooth and that the mesh contains no UV information. Otherwise Unity might split a vertex and then the script will not
/// find the correct contour. You should not use a very high polygon mesh since that will create a lot of nodes in the navmesh graph and slow
/// down pathfinding because of that. For very high polygon meshes it might even cause more suboptimal paths to be generated if it causes many
/// thin triangles to be added to the navmesh.
/// [Open online documentation to see images]
///
/// <b>Control updates through code</b>
/// Navmesh cuts are applied periodically, but sometimes you may want to ensure the graph is up to date right now.
/// Then you can use the following code.
/// <code>
/// // Schedule pending updates to be done as soon as the pathfinding threads
/// // are done with what they are currently doing.
/// You can also find this setting in the AstarPath inspector under Settings.
/// [Open online documentation to see images]
///
/// <b>Navmesh cutting and tags/penalties</b>
/// Because navmesh cutting can modify the triangles in the navmesh pretty much abitrarily it is not possible to keep tags and penalties when updating the graph.
/// The tags and penalties will be preserved for nodes which stay exactly the same when an update is applied though.
///
/// If you need to use tags, the only stable way to keep them is to apply all the graph updates that set them every time a navmesh cut update has been done.
/// This is of course relatively slow, but it will at least work.
/// 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.
///
/// This mesh should only be a 2D surface, not a volume.
/// </summary>
[Tooltip("The contour(s) of the mesh will be extracted. This mesh should only be a 2D surface, not a volume (see documentation).")]
publicMeshmesh;
/// <summary>Size of the rectangle</summary>
publicVector2rectangleSize=newVector2(1,1);
/// <summary>Radius of the circle</summary>
publicfloatcircleRadius=1;
/// <summary>Number of vertices on the circle</summary>
publicintcircleResolution=6;
/// <summary>The cut will be extruded to this height</summary>
publicfloatheight=1;
/// <summary>Scale of the custom mesh, if used</summary>
[Tooltip("Scale of the custom mesh")]
publicfloatmeshScale=1;
publicVector3center;
/// <summary>
/// Distance between positions to require an update of the navmesh.
/// A smaller distance gives better accuracy, but requires more updates when moving the object over time,
/// so it is often slower.
/// </summary>
[Tooltip("Distance between positions to require an update of the navmesh\nA smaller distance gives better accuracy, but requires more updates when moving the object over time, so it is often slower.")]
publicfloatupdateDistance=0.4f;
/// <summary>
/// Only makes a split in the navmesh, but does not remove the geometry to make a hole.
/// This is slower than a normal cut
/// </summary>
[Tooltip("Only makes a split in the navmesh, but does not remove the geometry to make a hole")]
publicboolisDual;
/// <summary>
/// Cuts geometry added by a NavmeshAdd component.
/// You rarely need to change this
/// </summary>
publicboolcutsAddedGeom=true;
/// <summary>
/// How many degrees rotation that is required for an update to the navmesh.
/// Should be between 0 and 180.
///
/// Note: Dynamic updating requires a Tile Handler Helper somewhere in the scene.
/// </summary>
[Tooltip("How many degrees rotation that is required for an update to the navmesh. Should be between 0 and 180.")]
publicfloatupdateRotationDistance=10;
/// <summary>
/// Includes rotation and scale in calculations.
/// This is slower since a lot more matrix multiplications are needed but gives more flexibility.
/// </summary>
[Tooltip("Includes rotation in calculations. This is slower since a lot more matrix multiplications are needed but gives more flexibility.")]