Class TileHandler

Public

Utility class for updating tiles of navmesh/recast graphs.

Most operations that this class does are asynchronous. They will be added as work items to the AstarPath class and executed when the pathfinding threads have finished calculating their current paths.

Inner Types

Cut

Internal class describing a single NavmeshCut.

Internal class representing a mesh which is the result of the CutPoly method.

A template for a single tile in a navmesh/recast graph.

Public Methods

ClearTile (x, z)

Clear the tile at the specified tile coordinates.

Public
CreateTileTypesFromGraph ()
Public
EndBatchLoad ()
Public
GetActiveRotation (p)

Rotation of the specified tile relative to the original rotation of the tile type.

Public
GetSourceTileData (x, z, verts, tris)

Vertices and triangles used as input for the navmesh cutting.

Public
LoadTile (tile, x, z, rotation, yoffset)

Load a tile at tile coordinate x, z.

Public
OnRecalculatedTiles (recalculatedTiles)

Call to update the specified tiles with new information based on the navmesh/recast graph.

Public
RegisterTileType (source, centerOffset, width=1, depth=1)

Register that a tile can be loaded from source.

Public
ReloadInBounds (bounds)

Reloads all tiles intersecting with the specified bounds.

Public
ReloadInBounds (tiles)

Reloads all tiles specified by the rectangle.

Public
ReloadTile (x, z)

Reload tile at tile coordinate.

Public
Resize (newTileBounds)

Resize the tile handler to a different tile count.

Public
StartBatchLoad ()

Start batch loading.

Public
TileHandler (graph)
Public

Public Variables

cuts

NavmeshCut and NavmeshAdd components registered to this tile handler.

Public Readonly
graph

The underlaying graph which is handled by this instance.

Public Readonly
isValid

True if the tile handler still has the same number of tiles and tile layout as the graph.

Public

Public Enums

CutMode
Public

Private/Protected Members

ClipAgainstRectangle (clipIn, clipOut, size)

Clips the input polygon against a rectangle with one corner at the origin and one at size in XZ space.

Private
CopyMesh (vertices, triangles, outVertices, outTriangles)

Copy mesh from (vertices, triangles) to (outVertices, outTriangles)

Private Static
CutAll (poly, intersectingCutIndices, cuts, result)
Private
CutDual (poly, tmpIntersectingCuts, cuts, hasDual, intermediateResult, result)
Private
CutExtra (poly, extraClipShape, result)
Private
CutPoly (verts, tris, extraShape, graphTransform, tiles, mode=…, perturbate=-1)

Cuts a piece of navmesh using navmesh cuts.

Private
DelaunayRefinement (verts, tris, tCount, delaunay, colinear)

Refine a mesh using delaunay refinement.

Private
PoolPolygon (polygon, pool)
Private Static
PrepareNavmeshCutsForCutting (navmeshCuts, transform, cutSpaceBounds, perturbate, anyNavmeshAdds, characterRadius)

Generates a list of cuts from the navmesh cut components.

Private Static
UpdateTileType (tile)
Private
activeTileOffsets

Offsets along the Y axis of the active tiles.

Private
activeTileRotations

Rotations of the active tiles.

Private
activeTileTypes

Which tile type is active on each tile index.

Private
batchDepth

Positive while batching tile updates.

Private
cached_Int2_int_dict

Cached dictionary to avoid excessive allocations.

Private Readonly
clipper

Handles polygon clipping operations.

Private Readonly
isBatching

True while batching tile updates.

Private
reloadedInBatch

A flag for each tile that is set to true if it has been reloaded while batching is in progress.

Private
simpleClipper

Utility for clipping polygons to rectangles.

Private Readonly
tileXCount

Number of tiles along the x axis.

Private
tileZCount

Number of tiles along the z axis.

Private