/// 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
/// Normal graph updates on recast/navmesh graphs, in contrast, only allow either just changing parameters on existing nodes (e.g make a whole triangle unwalkable), which is not very flexible, or recalculate whole tiles, which can be slow.
/// Navmesh cutting is typically significantly faster than recalculating whole tiles from scratch in a recast graph.
/// The NavmeshCut component uses a 2D shape to cut the navmesh with. This shape can be produced by either one of the built-in 2D shapes (rectangle/circle) or one of the 3D shapes (cube/sphere/capsule)
/// which will be projected down to a 2D shape when cutting happens. You can also specify a custom 2D mesh to use as a cut.
///
/// [Open online documentation to see images]
///
/// Note that the rectangle/circle shapes are not 3D. If you rotate them, you will see that the 2D shape will be rotated and then just projected down on the XZ plane.
/// Therefore it is recommended to use the 3D shapes (cube/sphere/capsule) in most cases since those are easier to use.
///
/// 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.
///
/// <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>Update frequency</b>
///
/// Navmesh cuts are typically pretty fast, so you may be tempted to make them update the navmesh very often (once every few frames perhaps), just because you can spare the CPU power.
/// However, updating the navmesh too often can also have consequences for agents that are following paths on the graph.
///
/// If a navmesh cut updates the graph near an agent, it will usually have to recalculate its path. If this happens too often, this can lead to the pathfinding
/// worker threads being overwhelmed by pathfinding requests, causing higher latency for individual pathfinding requests. This can, in turn, make agents less responsive.
///
/// So it's recommended to keep the update frequency reasonable. After all, a player is unlikely to notice if the navmesh was updated 20 times per second or 2 times per second (or even less often).
///
/// You can primarily control this using the <see cref="updateDistance"/> and <see cref="updateRotationDistance"/> fields. But you can also control the global frequency of updates. This is explained in the next section.
///
/// <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>
/// Navmesh cuts can only preserve tags for updates which happen when the graph is first scanned, or when a recast graph tile is recalculated from scratch.
///
/// This means that any tags that you apply dynamically using e.g. a <see cref="GraphUpdateScene"/> component may be lost when a navmesh cut is applied.
/// If you need to combine tags and navmesh cutting, it is therefore strongly recommended to use the <see cref="RecastNavmeshModifier"/> component to apply the tags,
/// Internally, what happens is that when a graph is scanned, the navmesh cutting subsystem takes a snapshot of all triangles in the graph, including tags. This data will then be referenced
/// every time cutting happens and the tags from the snapshot will be copied to the new triangles after cutting has taken place.
///
/// You can also apply tags and penalties using a graph update after cutting has taken place. For example by subclassing a navmesh cut and overriding the <see cref="UsedForCut"/> method.
/// <summary>A 3D box which will be projected down to a 2D outline</summary>
Box,
/// <summary>A 3D sphere which will be projected down to a 2D outline</summary>
Sphere,
/// <summary>A 3D capsule which will be projected down to a 2D outline</summary>
Capsule,
}
publicenumRadiusExpansionMode{
/// <summary>
/// If DontExpand is used then the cut will be exactly as specified with no modifications.
/// It will be the same for all graphs.
/// </summary>
DontExpand,
/// <summary>
/// If ExpandByAgentRadius is used then the cut will be expanded by the agent's radius (set in the recast graph settings)
/// in every direction. For navmesh graphs (which do not have a character radius) this is equivalent to DontExpand.
///
/// This is especially useful if you have multiple graphs for different unit sizes and want the cuts to be sized according to
/// the different units.
/// </summary>
ExpandByAgentRadius,
}
/// <summary>Shape of the cut</summary>
[Tooltip("Shape of the cut")]
publicMeshTypetype=MeshType.Box;
/// <summary>
/// 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.
///
/// 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>
/// How much the cut must move before the navmesh is updated.
/// A smaller distance gives better accuracy, but requires more updates when moving the object over time,
/// so it is often slower.
///
/// Even if the graph update itself is fast, having a low value can make agents have to recalculate their paths a lot more often,
/// leading to lower performance.
/// </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>
/// If the cut should be expanded by the agent radius or not.
///
/// See <see cref="RadiusExpansionMode"/> for more details.
/// The cut may contain several contours which is why the buffer is a list of lists.
/// </summary>
/// <param name="buffer">Will be filled with the result</param>
/// <param name="matrix">All points will be transformed using this matrix. They are in world space before the transformation. Typically this a transform that maps from world space to graph space.</param>
/// <param name="radiusMargin">The obstacle will be expanded by this amount. Typically this is the character radius for the graph. The MeshType.CustomMesh does not support this.
/// If #radiusExpansionMode is RadiusExpansionMode.DontExpand then this parameter is ignored.</param>
/// <param name="outputVertices">Will be filled with all vertices</param>
/// <param name="outputContours">Will be filled with all contours that reference the outputVertices list.</param>
/// <param name="matrix">All points will be transformed using this matrix. They are in world space before the transformation. Typically this a matrix that maps from world space to graph space.</param>
/// <param name="radiusMargin">The obstacle will be expanded by this amount. Typically this is the character radius for the graph. The MeshType.CustomMesh does not support this.</param>