class_gridmap.rst 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the GridMap.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_GridMap:
  5. GridMap
  6. =======
  7. **Inherits:** :ref:`Spatial<class_spatial>` **<** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Node for 3D tile-based maps.
  12. Member Functions
  13. ----------------
  14. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`clear<class_GridMap_clear>` **(** **)** |
  16. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`clear_baked_meshes<class_GridMap_clear_baked_meshes>` **(** **)** |
  18. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`RID<class_rid>` | :ref:`get_bake_mesh_instance<class_GridMap_get_bake_mesh_instance>` **(** :ref:`int<class_int>` idx **)** |
  20. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Array<class_array>` | :ref:`get_bake_meshes<class_GridMap_get_bake_meshes>` **(** **)** |
  22. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_cell_item<class_GridMap_get_cell_item>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** const |
  24. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`int<class_int>` | :ref:`get_cell_item_orientation<class_GridMap_get_cell_item_orientation>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** const |
  26. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`bool<class_bool>` | :ref:`get_collision_layer_bit<class_GridMap_get_collision_layer_bit>` **(** :ref:`int<class_int>` bit **)** const |
  28. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`bool<class_bool>` | :ref:`get_collision_mask_bit<class_GridMap_get_collision_mask_bit>` **(** :ref:`int<class_int>` bit **)** const |
  30. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`Array<class_array>` | :ref:`get_meshes<class_GridMap_get_meshes>` **(** **)** |
  32. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Array<class_array>` | :ref:`get_used_cells<class_GridMap_get_used_cells>` **(** **)** const |
  34. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`make_baked_meshes<class_GridMap_make_baked_meshes>` **(** :ref:`bool<class_bool>` gen_lightmap_uv=false, :ref:`float<class_float>` lightmap_uv_texel_size=0.1 **)** |
  36. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Vector3<class_vector3>` | :ref:`map_to_world<class_GridMap_map_to_world>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** const |
  38. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | void | :ref:`resource_changed<class_GridMap_resource_changed>` **(** :ref:`Resource<class_resource>` resource **)** |
  40. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_cell_item<class_GridMap_set_cell_item>` **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` item, :ref:`int<class_int>` orientation=0 **)** |
  42. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_clip<class_GridMap_set_clip>` **(** :ref:`bool<class_bool>` enabled, :ref:`bool<class_bool>` clipabove=true, :ref:`int<class_int>` floor=0, :ref:`int<class_int>` axis=0 **)** |
  44. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | void | :ref:`set_collision_layer_bit<class_GridMap_set_collision_layer_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  46. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`set_collision_mask_bit<class_GridMap_set_collision_mask_bit>` **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)** |
  48. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | :ref:`Vector3<class_vector3>` | :ref:`world_to_map<class_GridMap_world_to_map>` **(** :ref:`Vector3<class_vector3>` pos **)** const |
  50. +--------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. Member Variables
  52. ----------------
  53. .. _class_GridMap_cell_center_x:
  54. - :ref:`bool<class_bool>` **cell_center_x** - If ``true`` grid items are centered on the X axis.
  55. .. _class_GridMap_cell_center_y:
  56. - :ref:`bool<class_bool>` **cell_center_y** - If ``true`` grid items are centered on the Y axis.
  57. .. _class_GridMap_cell_center_z:
  58. - :ref:`bool<class_bool>` **cell_center_z** - If ``true`` grid items are centered on the Z axis.
  59. .. _class_GridMap_cell_octant_size:
  60. - :ref:`int<class_int>` **cell_octant_size** - The size of each octant measured in number of cells. This applies to all three axis.
  61. .. _class_GridMap_cell_scale:
  62. - :ref:`float<class_float>` **cell_scale**
  63. .. _class_GridMap_cell_size:
  64. - :ref:`Vector3<class_vector3>` **cell_size** - The dimensions of the grid's cells.
  65. .. _class_GridMap_collision_layer:
  66. - :ref:`int<class_int>` **collision_layer**
  67. .. _class_GridMap_collision_mask:
  68. - :ref:`int<class_int>` **collision_mask**
  69. .. _class_GridMap_theme:
  70. - :ref:`MeshLibrary<class_meshlibrary>` **theme** - The assigned :ref:`MeshLibrary<class_meshlibrary>`.
  71. Numeric Constants
  72. -----------------
  73. - **INVALID_CELL_ITEM** = **-1** --- Invalid cell item that can be used in :ref:`set_cell_item<class_GridMap_set_cell_item>` to clear cells (or represent an empty cell in :ref:`get_cell_item<class_GridMap_get_cell_item>`).
  74. Description
  75. -----------
  76. GridMap lets you place meshes on a grid interactively. It works both from the editor and can help you create in-game level editors.
  77. GridMaps use a :ref:`MeshLibrary<class_meshlibrary>` which contain a list of tiles: meshes with materials plus optional collisions and extra elements.
  78. A GridMap contains a collection of cells. Each grid cell refers to a :ref:`MeshLibrary<class_meshlibrary>` item. All cells in the map have the same dimensions.
  79. 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.
  80. Member Function Description
  81. ---------------------------
  82. .. _class_GridMap_clear:
  83. - void **clear** **(** **)**
  84. Clear all cells.
  85. .. _class_GridMap_clear_baked_meshes:
  86. - void **clear_baked_meshes** **(** **)**
  87. .. _class_GridMap_get_bake_mesh_instance:
  88. - :ref:`RID<class_rid>` **get_bake_mesh_instance** **(** :ref:`int<class_int>` idx **)**
  89. .. _class_GridMap_get_bake_meshes:
  90. - :ref:`Array<class_array>` **get_bake_meshes** **(** **)**
  91. .. _class_GridMap_get_cell_item:
  92. - :ref:`int<class_int>` **get_cell_item** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** const
  93. The :ref:`MeshLibrary<class_meshlibrary>` item index located at the grid-based X, Y and Z coordinates. If the cell is empty, INVALID_CELL_ITEM will be returned.
  94. .. _class_GridMap_get_cell_item_orientation:
  95. - :ref:`int<class_int>` **get_cell_item_orientation** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** const
  96. The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is retuned if the cell is empty.
  97. .. _class_GridMap_get_collision_layer_bit:
  98. - :ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** const
  99. .. _class_GridMap_get_collision_mask_bit:
  100. - :ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** const
  101. .. _class_GridMap_get_meshes:
  102. - :ref:`Array<class_array>` **get_meshes** **(** **)**
  103. Array of :ref:`Transform<class_transform>` and :ref:`Mesh<class_mesh>` references corresponding to the non empty cells in the grid. The transforms are specified in world space.
  104. .. _class_GridMap_get_used_cells:
  105. - :ref:`Array<class_array>` **get_used_cells** **(** **)** const
  106. Array of :ref:`Vector3<class_vector3>` with the non empty cell coordinates in the grid map.
  107. .. _class_GridMap_make_baked_meshes:
  108. - void **make_baked_meshes** **(** :ref:`bool<class_bool>` gen_lightmap_uv=false, :ref:`float<class_float>` lightmap_uv_texel_size=0.1 **)**
  109. .. _class_GridMap_map_to_world:
  110. - :ref:`Vector3<class_vector3>` **map_to_world** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z **)** const
  111. .. _class_GridMap_resource_changed:
  112. - void **resource_changed** **(** :ref:`Resource<class_resource>` resource **)**
  113. .. _class_GridMap_set_cell_item:
  114. - void **set_cell_item** **(** :ref:`int<class_int>` x, :ref:`int<class_int>` y, :ref:`int<class_int>` z, :ref:`int<class_int>` item, :ref:`int<class_int>` orientation=0 **)**
  115. Set the mesh index for the cell referenced by its grid-based X, Y and Z coordinates.
  116. A negative item index will clear the cell.
  117. Optionally, the item's orientation can be passed.
  118. .. _class_GridMap_set_clip:
  119. - void **set_clip** **(** :ref:`bool<class_bool>` enabled, :ref:`bool<class_bool>` clipabove=true, :ref:`int<class_int>` floor=0, :ref:`int<class_int>` axis=0 **)**
  120. .. _class_GridMap_set_collision_layer_bit:
  121. - void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  122. .. _class_GridMap_set_collision_mask_bit:
  123. - void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
  124. .. _class_GridMap_world_to_map:
  125. - :ref:`Vector3<class_vector3>` **world_to_map** **(** :ref:`Vector3<class_vector3>` pos **)** const