GridMap

Node for 3D tile-based maps.

GridMap lets you place meshes on a grid interactively. It works both from the editor and from scripts, which can help you create in-game level editors. GridMaps use a MeshLibrary which contains a list of tiles. Each tile is a mesh with materials plus optional collision and navigation shapes. A GridMap contains a collection of cells. Each grid cell refers to a tile in the MeshLibrary. All cells in the map have the same dimensions. Internally, 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. Note: GridMap doesn't extend VisualInstance and therefore can't be hidden or cull masked based on VisualInstance.layers. If you make a light not affect the first layer, the whole GridMap won't be lit by the light in question.

@GodotBaseClass
struct GridMap {}

Members

Aliases

BaseClasses
alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses)
Undocumented in source.

Enums

Constants
enum Constants

Functions

_updateOctantsCallback
void _updateOctantsCallback()
clear
void clear()

Clear all cells.

clearBakedMeshes
void clearBakedMeshes()
getBakeMeshInstance
RID getBakeMeshInstance(long idx)
getBakeMeshes
Array getBakeMeshes()

Returns an array of ArrayMeshes and Transform references of all bake meshes that exist within the current GridMap.

getCellItem
long getCellItem(long x, long y, long 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.

getCellItemOrientation
long getCellItemOrientation(long x, long y, long z)

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

getCellScale
double getCellScale()
getCellSize
Vector3 getCellSize()
getCenterX
bool getCenterX()
getCenterY
bool getCenterY()
getCenterZ
bool getCenterZ()
getCollisionLayer
long getCollisionLayer()
getCollisionLayerBit
bool getCollisionLayerBit(long bit)

Returns an individual bit on the collisionLayer.

getCollisionMask
long getCollisionMask()
getCollisionMaskBit
bool getCollisionMaskBit(long bit)

Returns an individual bit on the collisionMask.

getMeshLibrary
Ref!MeshLibrary getMeshLibrary()
getMeshes
Array getMeshes()

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

getOctantSize
long getOctantSize()
getUseInBakedLight
bool getUseInBakedLight()
getUsedCells
Array getUsedCells()

Returns an array of Vector3 with the non-empty cell coordinates in the grid map.

makeBakedMeshes
void makeBakedMeshes(bool gen_lightmap_uv, double lightmap_uv_texel_size)
mapToWorld
Vector3 mapToWorld(long x, long y, long z)

Returns the position of a grid cell in the GridMap's local coordinate space.

opAssign
typeof(null) opAssign(typeof(null) n)
opEquals
bool opEquals(GridMap other)
opEquals
bool opEquals(typeof(null) n)
resourceChanged
void resourceChanged(Resource resource)
setCellItem
void setCellItem(long x, long y, long z, long item, long orientation)

Sets the mesh index for the cell referenced by its grid-based X, Y and Z coordinates. A negative item index such as constant INVALID_CELL_ITEM will clear the cell. Optionally, the item's orientation can be passed. For valid orientation values, see Basis.getOrthogonalIndex.

setCellScale
void setCellScale(double scale)
setCellSize
void setCellSize(Vector3 size)
setCenterX
void setCenterX(bool enable)
setCenterY
void setCenterY(bool enable)
setCenterZ
void setCenterZ(bool enable)
setClip
void setClip(bool enabled, bool clipabove, long floor, long axis)
setCollisionLayer
void setCollisionLayer(long layer)
setCollisionLayerBit
void setCollisionLayerBit(long bit, bool value)

Sets an individual bit on the collisionLayer.

setCollisionMask
void setCollisionMask(long mask)
setCollisionMaskBit
void setCollisionMaskBit(long bit, bool value)

Sets an individual bit on the collisionMask.

setMeshLibrary
void setMeshLibrary(MeshLibrary mesh_library)
setOctantSize
void setOctantSize(long size)
setUseInBakedLight
void setUseInBakedLight(bool use_in_baked_light)
toHash
size_t toHash()
worldToMap
Vector3 worldToMap(Vector3 pos)

Returns the coordinates of the grid cell containing the given point. pos should be in the GridMap's local coordinate space.

Mixins

__anonymous
mixin baseCasts
Undocumented in source.

Properties

cellCenterX
bool cellCenterX [@property getter]
bool cellCenterX [@property setter]

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

cellCenterY
bool cellCenterY [@property getter]
bool cellCenterY [@property setter]

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

cellCenterZ
bool cellCenterZ [@property getter]
bool cellCenterZ [@property setter]

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

cellOctantSize
long cellOctantSize [@property getter]
long cellOctantSize [@property setter]

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

cellScale
double cellScale [@property getter]
double cellScale [@property setter]

The scale of the cell items. This does not affect the size of the grid cells themselves, only the items in them. This can be used to make cell items overlap their neighbors.

cellSize
Vector3 cellSize [@property getter]
Vector3 cellSize [@property setter]

The dimensions of the grid's cells. This does not affect the size of the meshes. See cellScale.

collisionLayer
long collisionLayer [@property getter]
long collisionLayer [@property setter]

The physics layers this GridMap is in. GridMaps act as static bodies, meaning they aren't affected by gravity or other forces. They only affect other physics bodies that collide with them.

collisionMask
long collisionMask [@property getter]
long collisionMask [@property setter]

The physics layers this GridMap detects collisions in. See url=https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html#collision-layers-and-masksCollision layers and masks/url in the documentation for more information.

meshLibrary
MeshLibrary meshLibrary [@property getter]
MeshLibrary meshLibrary [@property setter]

The assigned MeshLibrary.

useInBakedLight
bool useInBakedLight [@property getter]
bool useInBakedLight [@property setter]

Controls whether this GridMap will be baked in a BakedLightmap or not.

Static functions

_new
GridMap _new()

Construct a new instance of GridMap. Note: use memnew!GridMap instead.

Static variables

_classBindingInitialized
bool _classBindingInitialized;
Undocumented in source.

Structs

GDNativeClassBinding
struct GDNativeClassBinding
Undocumented in source.

Unions

__anonymous
union __anonymous
Undocumented in source.

Variables

_GODOT_internal_name
enum string _GODOT_internal_name;
Undocumented in source.

Mixed In Members

From mixin baseCasts

as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(To) as()
Undocumented in source. Be warned that the author may not have intended to support it.
as
inout(ToRef) as()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(To)
Undocumented in source.
opCast
template opCast(ToRef)
Undocumented in source.
opCast
void* opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
godot_object opCast()
Undocumented in source. Be warned that the author may not have intended to support it.
opCast
bool opCast()
Undocumented in source. Be warned that the author may not have intended to support it.

Meta