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

Public Member Functions

 TileType (Int3[] sourceVerts, int[] sourceTris, Int3 tileSize, Int3 centerOffset, int width=1, int depth=1)
 
 TileType (Mesh source, Int3 tileSize, Int3 centerOffset, int width=1, int depth=1)
 Create a new TileType.
 
void Load (out Int3[] verts, out int[] tris, int rotation, int yoffset)
 Load a tile, result given by the vert and tris array.
 

Properties

int Depth [get]
 
int Width [get]
 

Private Attributes

int depth
 
int lastRotation
 
int lastYOffset
 
Int3 offset
 
int[] tris
 
Int3[] verts
 
int width
 

Static Private Attributes

static readonly int[] Rotations
 Matrices for rotation.
 

Constructor & Destructor Documentation

TileType ( Int3[]  sourceVerts,
int[]  sourceTris,
Int3  tileSize,
Int3  centerOffset,
int  width = 1,
int  depth = 1 
)
TileType ( Mesh  source,
Int3  tileSize,
Int3  centerOffset,
int  width = 1,
int  depth = 1 
)

Create a new TileType.

First all vertices of the source mesh are offseted by the centerOffset. The source mesh is assumed to be centered (after offsetting). Corners of the tile should be at tileSize*0.5 along all axes. When width or depth is not 1, the tileSize param should not change, but corners of the tile are assumed to lie further out.

Parameters
sourceThe navmesh as a unity Mesh
widthThe number of base tiles this tile type occupies on the x-axis
depthThe number of base tiles this tile type occupies on the z-axis
tileSizeSize of a single tile, the y-coordinate will be ignored.

Member Function Documentation

void Load ( out Int3[]  verts,
out int[]  tris,
int  rotation,
int  yoffset 
)

Load a tile, result given by the vert and tris array.

Warning
For performance and memory reasons, the returned arrays are internal arrays, so they must not be modified in any way or subsequent calls to Load may give corrupt output. The contents of the verts array is only valid until the next call to Load since different rotations and y offsets can be applied. If you need persistent arrays, please copy the returned ones.

Member Data Documentation

int depth
private
int lastRotation
private
int lastYOffset
private
Int3 offset
private
readonly int [] Rotations
staticprivate
Initial value:
= {
1, 0,
0, 1,
0, 1,
-1, 0,
-1, 0,
0, -1,
0, -1,
1, 0
}

Matrices for rotation.

Each group of 4 elements is a 2x2 matrix. The XZ position is multiplied by this. So

//A rotation by 90 degrees clockwise, second matrix in the array
(5,2) * ((0, 1), (-1, 0)) = (2,-5)
int [] tris
private
Int3 [] verts
private
int width
private

Property Documentation

int Depth
get
int Width
get

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