Node for 3D tile-based maps.
GridMap lets you place meshes on a grid interactively. It works both from the editor and can help you create in-game level editors.
GridMaps use a [MeshLibrary] which contain a list of tiles: meshes with materials plus optional collisions and extra elements.
A GridMap contains a collection of cells. Each grid cell refers to a [MeshLibrary] item. All cells in the map have the same dimensions.
A GridMap is split into a sparse collection of octants for efficient rendering and physics processing. Every octant has the same dimensions and can contain several cells.
Clear all cells.
The [MeshLibrary] item index located at the grid-based X, Y and Z coordinates. If the cell is empty, [INVALID_CELL_ITEM] will be returned.
The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is retuned if the cell is empty.
The dimensions of the grid's cells.
Returns whether or not grid items are centered on the X axis.
Returns whether or not grid items are centered on the Y axis.
Returns whether or not grid items are centered on the Z axis.
Array of [Transform] and [Mesh] references corresponding to the non empty cells in the grid. The transforms are specified in world space.
The size of each octant measured in number of cells. This applies to all three axis.
The assigned [MeshLibrary].
Array of [Vector3] with the non empty cell coordinates in the grid map.
Set the mesh index for the cell referenced by its grid-based X, Y and Z coordinates.
A negative item index will clear the cell.
Optionally, the item's orientation can be passed.
Sets the height, width and depth of the grid's cells.
Set grid items to be centered on the X axis. By default it is enabled.
Set grid items to be centered on the Y axis. By default it is enabled.
Set grid items to be centered on the Z axis. By default it is enabled.
Sets the size for each octant measured in number of cells. This applies to all three axis.
Sets the collection of meshes for the map.
Invalid cell item that can be used in [method set_cell_item] to clear cells (or represent an empty cell in [method get_cell_item]).