GridMap
Category: Core
Node for 3D tile-based maps.
Properties
void | ( ) |
void | clear_baked_meshes ( ) |
get_bake_mesh_instance ( idx ) | |
Array | ( ) |
int | ( int x, y, int z ) const |
get_cell_item_orientation ( x, int y, z ) const | |
bool | ( int bit ) const |
get_collision_mask_bit ( bit ) const | |
Array | ( ) |
Array | ( ) const |
void | make_baked_meshes ( gen_lightmap_uv=false, float lightmap_uv_texel_size=0.1 ) |
map_to_world ( x, int y, z ) const | |
void | resource_changed ( resource ) |
void | set_cell_item ( x, int y, z, int item, orientation=0 ) |
void | set_clip ( enabled, bool clipabove=true, floor=0, Vector3.Axis axis=0 ) |
void | set_collision_layer_bit ( bit, bool value ) |
void | ( int bit, value ) |
Vector3 | ( Vector3 pos ) const |
Constants
- INVALID_CELL_ITEM = -1 — Invalid cell item that can be used in to clear cells (or represent an empty cell in get_cell_item).
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 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.
Tutorials
- bool cell_center_x
Setter | set_center_x(value) |
Getter | get_center_x() |
- cell_center_y
Setter | set_center_y(value) |
Getter | get_center_y() |
If , grid items are centered on the Y axis.
If , grid items are centered on the Z axis.
- int cell_octant_size
Setter | set_octant_size(value) |
Getter | get_octant_size() |
The size of each octant measured in number of cells. This applies to all three axis.
- cell_scale
Setter | set_cell_scale(value) |
Getter | get_cell_scale() |
- Vector3 cell_size
Setter | set_cell_size(value) |
Getter | get_cell_size() |
The dimensions of the grid’s cells.
- collision_layer
- int collision_mask
Setter | set_collision_mask(value) |
Getter | get_collision_mask() |
- mesh_library
Setter | set_mesh_library(value) |
Getter | get_mesh_library() |
The assigned MeshLibrary.
- theme
Setter | set_theme(value) |
Getter | get_theme() |
Deprecated, use mesh_library instead.
Method Descriptions
- void clear ( )
- void clear_baked_meshes ( )
- get_bake_mesh_instance ( int idx )
- get_bake_meshes ( )
The MeshLibrary item index located at the grid-based X, Y and Z coordinates. If the cell is empty, will be returned.
The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is returned if the cell is empty.
- bool get_collision_layer_bit ( bit ) const
- bool get_collision_mask_bit ( bit ) const
- Array get_meshes ( )
Array of and Mesh references corresponding to the non empty cells in the grid. The transforms are specified in world space.
- get_used_cells ( ) const
Array of Vector3 with the non empty cell coordinates in the grid map.
- void make_baked_meshes ( gen_lightmap_uv=false, float lightmap_uv_texel_size=0.1 )
- void resource_changed ( resource )
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.
- void set_clip ( enabled, bool clipabove=true, floor=0, Vector3.Axis axis=0 )
- void set_collision_layer_bit ( int bit, value )
- void set_collision_mask_bit ( int bit, value )
- Vector3 world_to_map ( pos ) const