Node for 3D tile-based maps.
    public class GridMap : Spatial

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.

Inheritance Chain

Static Fields

    public const Int32 InvalidCellItem = -1

Constructors

    public GridMap()

Properties

    public bool CellCenterX { get; set; }

If true, grid items are centered on the X axis.

    public bool CellCenterY { get; set; }

If true, grid items are centered on the Y axis.

    public bool CellCenterZ { get; set; }

If true, grid items are centered on the Z axis.

    public int CellOctantSize { get; set; }

The size of each octant measured in number of cells. This applies to all three axis.

    public float CellScale { get; set; }

    public Vector3 CellSize { get; set; }

The dimensions of the grid’s cells.

    public uint CollisionLayer { get; set; }

    public uint CollisionMask { get; set; }

    public MeshLibrary MeshLibrary { get; set; }

The assigned MeshLibrary.

    public MeshLibrary Theme { get; set; }

Deprecated, use MeshLibrary instead.

Methods

    public void Clear()

Clear all cells.

    public void ClearBakedMeshes()

    public Godot.Collections.Array GetBakeMeshes()

    public RID GetBakeMeshInstance(int idx)

    public int GetCellItem(int x, int y, int z)

The MeshLibrary item index located at the grid-based X, Y and Z coordinates. If the cell is empty, [constant INVALID_CELL_ITEM] will be returned.

    public int GetCellItemOrientation(int x, int y, int z)

The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is returned if the cell is empty.

    [Obsolete("GetCellScale is deprecated. Use the CellScale property instead.")]
    public float GetCellScale()

Getter for CellScale

    [Obsolete("GetCellSize is deprecated. Use the CellSize property instead.")]
    public Vector3 GetCellSize()

Getter for CellSize

    [Obsolete("GetCenterX is deprecated. Use the CellCenterX property instead.")]
    public bool GetCenterX()

Getter for CellCenterX

    [Obsolete("GetCenterY is deprecated. Use the CellCenterY property instead.")]
    public bool GetCenterY()

Getter for CellCenterY

    [Obsolete("GetCenterZ is deprecated. Use the CellCenterZ property instead.")]
    public bool GetCenterZ()

Getter for CellCenterZ

    [Obsolete("GetCollisionLayer is deprecated. Use the CollisionLayer property instead.")]
    public uint GetCollisionLayer()

    public bool GetCollisionLayerBit(int bit)

    [Obsolete("GetCollisionMask is deprecated. Use the CollisionMask property instead.")]
    public uint GetCollisionMask()

    public bool GetCollisionMaskBit(int bit)

    public Godot.Collections.Array GetMeshes()

Array of Transform and Mesh references corresponding to the non-empty cells in the grid. The transforms are specified in world space.

    [Obsolete("GetMeshLibrary is deprecated. Use the MeshLibrary property instead.")]
    public MeshLibrary GetMeshLibrary()

Getter for MeshLibrary

    [Obsolete("GetOctantSize is deprecated. Use the CellOctantSize property instead.")]
    public int GetOctantSize()

Getter for CellOctantSize

    [Obsolete("GetTheme is deprecated. Use the Theme property instead.")]
    public MeshLibrary GetTheme()

Getter for Theme

    public Godot.Collections.Array GetUsedCells()

Array of Vector3 with the non-empty cell coordinates in the grid map.

    public void MakeBakedMeshes(bool genLightmapUv = false, float lightmapUvTexelSize = 0.1f)

    public Vector3 MapToWorld(int x, int y, int z)

    public void ResourceChanged(Resource resource)

    public void SetCellItem(int x, int y, int z, int item, int orientation = 0)

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.

    [Obsolete("SetCellScale is deprecated. Use the CellScale property instead.")]
    public void SetCellScale(float scale)

Setter for CellScale

    [Obsolete("SetCellSize is deprecated. Use the CellSize property instead.")]
    public void SetCellSize(Vector3 size)

Setter for CellSize

    [Obsolete("SetCenterX is deprecated. Use the CellCenterX property instead.")]
    public void SetCenterX(bool enable)

Setter for CellCenterX

    [Obsolete("SetCenterY is deprecated. Use the CellCenterY property instead.")]
    public void SetCenterY(bool enable)

Setter for CellCenterY

    [Obsolete("SetCenterZ is deprecated. Use the CellCenterZ property instead.")]
    public void SetCenterZ(bool enable)

Setter for CellCenterZ

    public void SetClip(bool enabled, bool clipabove = true, int floor = 0, Vector3.Axis axis = Vector3.Axis.X)

    [Obsolete("SetCollisionLayer is deprecated. Use the CollisionLayer property instead.")]
    public void SetCollisionLayer(uint layer)

    public void SetCollisionLayerBit(int bit, bool value)

    [Obsolete("SetCollisionMask is deprecated. Use the CollisionMask property instead.")]
    public void SetCollisionMask(uint mask)

    public void SetCollisionMaskBit(int bit, bool value)

    [Obsolete("SetMeshLibrary is deprecated. Use the MeshLibrary property instead.")]
    public void SetMeshLibrary(MeshLibrary meshLibrary)

Setter for MeshLibrary

    [Obsolete("SetOctantSize is deprecated. Use the CellOctantSize property instead.")]
    public void SetOctantSize(int size)

Setter for CellOctantSize

    [Obsolete("SetTheme is deprecated. Use the Theme property instead.")]
    public void SetTheme(MeshLibrary theme)

Setter for Theme

    public Vector3 WorldToMap(Vector3 pos)
Tags: