Table of Contents

Method UpdateTileGridOrientations

Namespace
Gamelogic.Grids2
Assembly
Gamelogic.Grids2.dll

UpdateTileGridOrientations<TPoint, TCell>(IGrid<TPoint, TCell>, GridMap<TPoint>)

Orientates cells according to the map.

public static void UpdateTileGridOrientations<TPoint, TCell>(IGrid<TPoint, TCell> grid, GridMap<TPoint> map) where TCell : MonoBehaviour

Parameters

grid IGrid<TPoint, TCell>

The grid that contains the cells to re-orientate.

map GridMap<TPoint>

The map used to do the orientation calculations.

Type Parameters

TPoint

The point type of the grid.

TCell

The cell type of the grid.

Remarks

New forward, right and up vectors are calculated by applying the map to the end points. For example, the up vector for a cell is (0, 1, 0). If the cell is at the world position (2, 2, 2) before the space map is applied, the endpoint of the up vector is (2, 3, 2). The map is applied to both these points, and their difference is the "new" up vector. The cell is rotated so that it matches (as far as is possible) the new orientation vectors. Applying this method on cubes in a polar grid will make them face the center.