class_gridmap.rst 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  1. :github_url: hide
  2. .. meta::
  3. :keywords: tilemap
  4. .. DO NOT EDIT THIS FILE!!!
  5. .. Generated automatically from Godot engine sources.
  6. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  7. .. XML source: https://github.com/godotengine/godot/tree/master/modules/gridmap/doc_classes/GridMap.xml.
  8. .. _class_GridMap:
  9. GridMap
  10. =======
  11. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  12. Node for 3D tile-based maps.
  13. .. rst-class:: classref-introduction-group
  14. Description
  15. -----------
  16. 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.
  17. GridMaps use a :ref:`MeshLibrary<class_MeshLibrary>` which contains a list of tiles. Each tile is a mesh with materials plus optional collision and navigation shapes.
  18. A GridMap contains a collection of cells. Each grid cell refers to a tile in the :ref:`MeshLibrary<class_MeshLibrary>`. All cells in the map have the same dimensions.
  19. 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.
  20. \ **Note:** GridMap doesn't extend :ref:`VisualInstance3D<class_VisualInstance3D>` and therefore can't be hidden or cull masked based on :ref:`VisualInstance3D.layers<class_VisualInstance3D_property_layers>`. If you make a light not affect the first layer, the whole GridMap won't be lit by the light in question.
  21. .. rst-class:: classref-introduction-group
  22. Tutorials
  23. ---------
  24. - :doc:`Using gridmaps <../tutorials/3d/using_gridmaps>`
  25. - `3D Platformer Demo <https://godotengine.org/asset-library/asset/2748>`__
  26. - `3D Kinematic Character Demo <https://godotengine.org/asset-library/asset/2739>`__
  27. .. rst-class:: classref-reftable-group
  28. Properties
  29. ----------
  30. .. table::
  31. :widths: auto
  32. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  33. | :ref:`bool<class_bool>` | :ref:`bake_navigation<class_GridMap_property_bake_navigation>` | ``false`` |
  34. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  35. | :ref:`bool<class_bool>` | :ref:`cell_center_x<class_GridMap_property_cell_center_x>` | ``true`` |
  36. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  37. | :ref:`bool<class_bool>` | :ref:`cell_center_y<class_GridMap_property_cell_center_y>` | ``true`` |
  38. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  39. | :ref:`bool<class_bool>` | :ref:`cell_center_z<class_GridMap_property_cell_center_z>` | ``true`` |
  40. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  41. | :ref:`int<class_int>` | :ref:`cell_octant_size<class_GridMap_property_cell_octant_size>` | ``8`` |
  42. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  43. | :ref:`float<class_float>` | :ref:`cell_scale<class_GridMap_property_cell_scale>` | ``1.0`` |
  44. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  45. | :ref:`Vector3<class_Vector3>` | :ref:`cell_size<class_GridMap_property_cell_size>` | ``Vector3(2, 2, 2)`` |
  46. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  47. | :ref:`int<class_int>` | :ref:`collision_layer<class_GridMap_property_collision_layer>` | ``1`` |
  48. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  49. | :ref:`int<class_int>` | :ref:`collision_mask<class_GridMap_property_collision_mask>` | ``1`` |
  50. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  51. | :ref:`float<class_float>` | :ref:`collision_priority<class_GridMap_property_collision_priority>` | ``1.0`` |
  52. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  53. | :ref:`MeshLibrary<class_MeshLibrary>` | :ref:`mesh_library<class_GridMap_property_mesh_library>` | |
  54. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  55. | :ref:`PhysicsMaterial<class_PhysicsMaterial>` | :ref:`physics_material<class_GridMap_property_physics_material>` | |
  56. +-----------------------------------------------+----------------------------------------------------------------------+----------------------+
  57. .. rst-class:: classref-reftable-group
  58. Methods
  59. -------
  60. .. table::
  61. :widths: auto
  62. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | |void| | :ref:`clear<class_GridMap_method_clear>`\ (\ ) |
  64. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`clear_baked_meshes<class_GridMap_method_clear_baked_meshes>`\ (\ ) |
  66. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`RID<class_RID>` | :ref:`get_bake_mesh_instance<class_GridMap_method_get_bake_mesh_instance>`\ (\ idx\: :ref:`int<class_int>`\ ) |
  68. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | :ref:`Array<class_Array>` | :ref:`get_bake_meshes<class_GridMap_method_get_bake_meshes>`\ (\ ) |
  70. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | :ref:`Basis<class_Basis>` | :ref:`get_basis_with_orthogonal_index<class_GridMap_method_get_basis_with_orthogonal_index>`\ (\ index\: :ref:`int<class_int>`\ ) |const| |
  72. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | :ref:`int<class_int>` | :ref:`get_cell_item<class_GridMap_method_get_cell_item>`\ (\ position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| |
  74. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | :ref:`Basis<class_Basis>` | :ref:`get_cell_item_basis<class_GridMap_method_get_cell_item_basis>`\ (\ position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| |
  76. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | :ref:`int<class_int>` | :ref:`get_cell_item_orientation<class_GridMap_method_get_cell_item_orientation>`\ (\ position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| |
  78. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | :ref:`bool<class_bool>` | :ref:`get_collision_layer_value<class_GridMap_method_get_collision_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  80. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | :ref:`bool<class_bool>` | :ref:`get_collision_mask_value<class_GridMap_method_get_collision_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| |
  82. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | :ref:`Array<class_Array>` | :ref:`get_meshes<class_GridMap_method_get_meshes>`\ (\ ) |const| |
  84. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | :ref:`RID<class_RID>` | :ref:`get_navigation_map<class_GridMap_method_get_navigation_map>`\ (\ ) |const| |
  86. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | :ref:`int<class_int>` | :ref:`get_orthogonal_index_from_basis<class_GridMap_method_get_orthogonal_index_from_basis>`\ (\ basis\: :ref:`Basis<class_Basis>`\ ) |const| |
  88. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | :ref:`Array<class_Array>`\[:ref:`Vector3i<class_Vector3i>`\] | :ref:`get_used_cells<class_GridMap_method_get_used_cells>`\ (\ ) |const| |
  90. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. | :ref:`Array<class_Array>`\[:ref:`Vector3i<class_Vector3i>`\] | :ref:`get_used_cells_by_item<class_GridMap_method_get_used_cells_by_item>`\ (\ item\: :ref:`int<class_int>`\ ) |const| |
  92. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  93. | :ref:`Vector3i<class_Vector3i>` | :ref:`local_to_map<class_GridMap_method_local_to_map>`\ (\ local_position\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  94. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  95. | |void| | :ref:`make_baked_meshes<class_GridMap_method_make_baked_meshes>`\ (\ gen_lightmap_uv\: :ref:`bool<class_bool>` = false, lightmap_uv_texel_size\: :ref:`float<class_float>` = 0.1\ ) |
  96. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  97. | :ref:`Vector3<class_Vector3>` | :ref:`map_to_local<class_GridMap_method_map_to_local>`\ (\ map_position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| |
  98. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  99. | |void| | :ref:`resource_changed<class_GridMap_method_resource_changed>`\ (\ resource\: :ref:`Resource<class_Resource>`\ ) |
  100. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  101. | |void| | :ref:`set_cell_item<class_GridMap_method_set_cell_item>`\ (\ position\: :ref:`Vector3i<class_Vector3i>`, item\: :ref:`int<class_int>`, orientation\: :ref:`int<class_int>` = 0\ ) |
  102. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  103. | |void| | :ref:`set_collision_layer_value<class_GridMap_method_set_collision_layer_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  104. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  105. | |void| | :ref:`set_collision_mask_value<class_GridMap_method_set_collision_mask_value>`\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) |
  106. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  107. | |void| | :ref:`set_navigation_map<class_GridMap_method_set_navigation_map>`\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) |
  108. +--------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  109. .. rst-class:: classref-section-separator
  110. ----
  111. .. rst-class:: classref-descriptions-group
  112. Signals
  113. -------
  114. .. _class_GridMap_signal_cell_size_changed:
  115. .. rst-class:: classref-signal
  116. **cell_size_changed**\ (\ cell_size\: :ref:`Vector3<class_Vector3>`\ ) :ref:`๐Ÿ”—<class_GridMap_signal_cell_size_changed>`
  117. Emitted when :ref:`cell_size<class_GridMap_property_cell_size>` changes.
  118. .. rst-class:: classref-item-separator
  119. ----
  120. .. _class_GridMap_signal_changed:
  121. .. rst-class:: classref-signal
  122. **changed**\ (\ ) :ref:`๐Ÿ”—<class_GridMap_signal_changed>`
  123. Emitted when the :ref:`MeshLibrary<class_MeshLibrary>` of this GridMap changes.
  124. .. rst-class:: classref-section-separator
  125. ----
  126. .. rst-class:: classref-descriptions-group
  127. Constants
  128. ---------
  129. .. _class_GridMap_constant_INVALID_CELL_ITEM:
  130. .. rst-class:: classref-constant
  131. **INVALID_CELL_ITEM** = ``-1`` :ref:`๐Ÿ”—<class_GridMap_constant_INVALID_CELL_ITEM>`
  132. Invalid cell item that can be used in :ref:`set_cell_item<class_GridMap_method_set_cell_item>` to clear cells (or represent an empty cell in :ref:`get_cell_item<class_GridMap_method_get_cell_item>`).
  133. .. rst-class:: classref-section-separator
  134. ----
  135. .. rst-class:: classref-descriptions-group
  136. Property Descriptions
  137. ---------------------
  138. .. _class_GridMap_property_bake_navigation:
  139. .. rst-class:: classref-property
  140. :ref:`bool<class_bool>` **bake_navigation** = ``false`` :ref:`๐Ÿ”—<class_GridMap_property_bake_navigation>`
  141. .. rst-class:: classref-property-setget
  142. - |void| **set_bake_navigation**\ (\ value\: :ref:`bool<class_bool>`\ )
  143. - :ref:`bool<class_bool>` **is_baking_navigation**\ (\ )
  144. If ``true``, this GridMap creates a navigation region for each cell that uses a :ref:`mesh_library<class_GridMap_property_mesh_library>` item with a navigation mesh. The created navigation region will use the navigation layers bitmask assigned to the :ref:`MeshLibrary<class_MeshLibrary>`'s item.
  145. .. rst-class:: classref-item-separator
  146. ----
  147. .. _class_GridMap_property_cell_center_x:
  148. .. rst-class:: classref-property
  149. :ref:`bool<class_bool>` **cell_center_x** = ``true`` :ref:`๐Ÿ”—<class_GridMap_property_cell_center_x>`
  150. .. rst-class:: classref-property-setget
  151. - |void| **set_center_x**\ (\ value\: :ref:`bool<class_bool>`\ )
  152. - :ref:`bool<class_bool>` **get_center_x**\ (\ )
  153. If ``true``, grid items are centered on the X axis.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_GridMap_property_cell_center_y:
  157. .. rst-class:: classref-property
  158. :ref:`bool<class_bool>` **cell_center_y** = ``true`` :ref:`๐Ÿ”—<class_GridMap_property_cell_center_y>`
  159. .. rst-class:: classref-property-setget
  160. - |void| **set_center_y**\ (\ value\: :ref:`bool<class_bool>`\ )
  161. - :ref:`bool<class_bool>` **get_center_y**\ (\ )
  162. If ``true``, grid items are centered on the Y axis.
  163. .. rst-class:: classref-item-separator
  164. ----
  165. .. _class_GridMap_property_cell_center_z:
  166. .. rst-class:: classref-property
  167. :ref:`bool<class_bool>` **cell_center_z** = ``true`` :ref:`๐Ÿ”—<class_GridMap_property_cell_center_z>`
  168. .. rst-class:: classref-property-setget
  169. - |void| **set_center_z**\ (\ value\: :ref:`bool<class_bool>`\ )
  170. - :ref:`bool<class_bool>` **get_center_z**\ (\ )
  171. If ``true``, grid items are centered on the Z axis.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_GridMap_property_cell_octant_size:
  175. .. rst-class:: classref-property
  176. :ref:`int<class_int>` **cell_octant_size** = ``8`` :ref:`๐Ÿ”—<class_GridMap_property_cell_octant_size>`
  177. .. rst-class:: classref-property-setget
  178. - |void| **set_octant_size**\ (\ value\: :ref:`int<class_int>`\ )
  179. - :ref:`int<class_int>` **get_octant_size**\ (\ )
  180. The size of each octant measured in number of cells. This applies to all three axis.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_GridMap_property_cell_scale:
  184. .. rst-class:: classref-property
  185. :ref:`float<class_float>` **cell_scale** = ``1.0`` :ref:`๐Ÿ”—<class_GridMap_property_cell_scale>`
  186. .. rst-class:: classref-property-setget
  187. - |void| **set_cell_scale**\ (\ value\: :ref:`float<class_float>`\ )
  188. - :ref:`float<class_float>` **get_cell_scale**\ (\ )
  189. The scale of the cell items.
  190. 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.
  191. .. rst-class:: classref-item-separator
  192. ----
  193. .. _class_GridMap_property_cell_size:
  194. .. rst-class:: classref-property
  195. :ref:`Vector3<class_Vector3>` **cell_size** = ``Vector3(2, 2, 2)`` :ref:`๐Ÿ”—<class_GridMap_property_cell_size>`
  196. .. rst-class:: classref-property-setget
  197. - |void| **set_cell_size**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  198. - :ref:`Vector3<class_Vector3>` **get_cell_size**\ (\ )
  199. The dimensions of the grid's cells.
  200. This does not affect the size of the meshes. See :ref:`cell_scale<class_GridMap_property_cell_scale>`.
  201. .. rst-class:: classref-item-separator
  202. ----
  203. .. _class_GridMap_property_collision_layer:
  204. .. rst-class:: classref-property
  205. :ref:`int<class_int>` **collision_layer** = ``1`` :ref:`๐Ÿ”—<class_GridMap_property_collision_layer>`
  206. .. rst-class:: classref-property-setget
  207. - |void| **set_collision_layer**\ (\ value\: :ref:`int<class_int>`\ )
  208. - :ref:`int<class_int>` **get_collision_layer**\ (\ )
  209. The physics layers this GridMap is in.
  210. 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.
  211. .. rst-class:: classref-item-separator
  212. ----
  213. .. _class_GridMap_property_collision_mask:
  214. .. rst-class:: classref-property
  215. :ref:`int<class_int>` **collision_mask** = ``1`` :ref:`๐Ÿ”—<class_GridMap_property_collision_mask>`
  216. .. rst-class:: classref-property-setget
  217. - |void| **set_collision_mask**\ (\ value\: :ref:`int<class_int>`\ )
  218. - :ref:`int<class_int>` **get_collision_mask**\ (\ )
  219. The physics layers this GridMap detects collisions in. See `Collision layers and masks <../tutorials/physics/physics_introduction.html#collision-layers-and-masks>`__ in the documentation for more information.
  220. .. rst-class:: classref-item-separator
  221. ----
  222. .. _class_GridMap_property_collision_priority:
  223. .. rst-class:: classref-property
  224. :ref:`float<class_float>` **collision_priority** = ``1.0`` :ref:`๐Ÿ”—<class_GridMap_property_collision_priority>`
  225. .. rst-class:: classref-property-setget
  226. - |void| **set_collision_priority**\ (\ value\: :ref:`float<class_float>`\ )
  227. - :ref:`float<class_float>` **get_collision_priority**\ (\ )
  228. The priority used to solve colliding when occurring penetration. The higher the priority is, the lower the penetration into the object will be. This can for example be used to prevent the player from breaking through the boundaries of a level.
  229. .. rst-class:: classref-item-separator
  230. ----
  231. .. _class_GridMap_property_mesh_library:
  232. .. rst-class:: classref-property
  233. :ref:`MeshLibrary<class_MeshLibrary>` **mesh_library** :ref:`๐Ÿ”—<class_GridMap_property_mesh_library>`
  234. .. rst-class:: classref-property-setget
  235. - |void| **set_mesh_library**\ (\ value\: :ref:`MeshLibrary<class_MeshLibrary>`\ )
  236. - :ref:`MeshLibrary<class_MeshLibrary>` **get_mesh_library**\ (\ )
  237. The assigned :ref:`MeshLibrary<class_MeshLibrary>`.
  238. .. rst-class:: classref-item-separator
  239. ----
  240. .. _class_GridMap_property_physics_material:
  241. .. rst-class:: classref-property
  242. :ref:`PhysicsMaterial<class_PhysicsMaterial>` **physics_material** :ref:`๐Ÿ”—<class_GridMap_property_physics_material>`
  243. .. rst-class:: classref-property-setget
  244. - |void| **set_physics_material**\ (\ value\: :ref:`PhysicsMaterial<class_PhysicsMaterial>`\ )
  245. - :ref:`PhysicsMaterial<class_PhysicsMaterial>` **get_physics_material**\ (\ )
  246. Overrides the default friction and bounce physics properties for the whole **GridMap**.
  247. .. rst-class:: classref-section-separator
  248. ----
  249. .. rst-class:: classref-descriptions-group
  250. Method Descriptions
  251. -------------------
  252. .. _class_GridMap_method_clear:
  253. .. rst-class:: classref-method
  254. |void| **clear**\ (\ ) :ref:`๐Ÿ”—<class_GridMap_method_clear>`
  255. Clear all cells.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_GridMap_method_clear_baked_meshes:
  259. .. rst-class:: classref-method
  260. |void| **clear_baked_meshes**\ (\ ) :ref:`๐Ÿ”—<class_GridMap_method_clear_baked_meshes>`
  261. Clears all baked meshes. See :ref:`make_baked_meshes<class_GridMap_method_make_baked_meshes>`.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_GridMap_method_get_bake_mesh_instance:
  265. .. rst-class:: classref-method
  266. :ref:`RID<class_RID>` **get_bake_mesh_instance**\ (\ idx\: :ref:`int<class_int>`\ ) :ref:`๐Ÿ”—<class_GridMap_method_get_bake_mesh_instance>`
  267. Returns :ref:`RID<class_RID>` of a baked mesh with the given ``idx``.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_GridMap_method_get_bake_meshes:
  271. .. rst-class:: classref-method
  272. :ref:`Array<class_Array>` **get_bake_meshes**\ (\ ) :ref:`๐Ÿ”—<class_GridMap_method_get_bake_meshes>`
  273. Returns an array of :ref:`ArrayMesh<class_ArrayMesh>`\ es and :ref:`Transform3D<class_Transform3D>` references of all bake meshes that exist within the current GridMap.
  274. .. rst-class:: classref-item-separator
  275. ----
  276. .. _class_GridMap_method_get_basis_with_orthogonal_index:
  277. .. rst-class:: classref-method
  278. :ref:`Basis<class_Basis>` **get_basis_with_orthogonal_index**\ (\ index\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_basis_with_orthogonal_index>`
  279. Returns one of 24 possible rotations that lie along the vectors (x,y,z) with each component being either -1, 0, or 1. For further details, refer to the Godot source code.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_GridMap_method_get_cell_item:
  283. .. rst-class:: classref-method
  284. :ref:`int<class_int>` **get_cell_item**\ (\ position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_cell_item>`
  285. The :ref:`MeshLibrary<class_MeshLibrary>` item index located at the given grid coordinates. If the cell is empty, :ref:`INVALID_CELL_ITEM<class_GridMap_constant_INVALID_CELL_ITEM>` will be returned.
  286. .. rst-class:: classref-item-separator
  287. ----
  288. .. _class_GridMap_method_get_cell_item_basis:
  289. .. rst-class:: classref-method
  290. :ref:`Basis<class_Basis>` **get_cell_item_basis**\ (\ position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_cell_item_basis>`
  291. Returns the basis that gives the specified cell its orientation.
  292. .. rst-class:: classref-item-separator
  293. ----
  294. .. _class_GridMap_method_get_cell_item_orientation:
  295. .. rst-class:: classref-method
  296. :ref:`int<class_int>` **get_cell_item_orientation**\ (\ position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_cell_item_orientation>`
  297. The orientation of the cell at the given grid coordinates. ``-1`` is returned if the cell is empty.
  298. .. rst-class:: classref-item-separator
  299. ----
  300. .. _class_GridMap_method_get_collision_layer_value:
  301. .. rst-class:: classref-method
  302. :ref:`bool<class_bool>` **get_collision_layer_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_collision_layer_value>`
  303. Returns whether or not the specified layer of the :ref:`collision_layer<class_GridMap_property_collision_layer>` is enabled, given a ``layer_number`` between 1 and 32.
  304. .. rst-class:: classref-item-separator
  305. ----
  306. .. _class_GridMap_method_get_collision_mask_value:
  307. .. rst-class:: classref-method
  308. :ref:`bool<class_bool>` **get_collision_mask_value**\ (\ layer_number\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_collision_mask_value>`
  309. Returns whether or not the specified layer of the :ref:`collision_mask<class_GridMap_property_collision_mask>` is enabled, given a ``layer_number`` between 1 and 32.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_GridMap_method_get_meshes:
  313. .. rst-class:: classref-method
  314. :ref:`Array<class_Array>` **get_meshes**\ (\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_meshes>`
  315. Returns an array of :ref:`Transform3D<class_Transform3D>` and :ref:`Mesh<class_Mesh>` references corresponding to the non-empty cells in the grid. The transforms are specified in local space.
  316. .. rst-class:: classref-item-separator
  317. ----
  318. .. _class_GridMap_method_get_navigation_map:
  319. .. rst-class:: classref-method
  320. :ref:`RID<class_RID>` **get_navigation_map**\ (\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_navigation_map>`
  321. Returns the :ref:`RID<class_RID>` of the navigation map this GridMap node uses for its cell baked navigation meshes.
  322. This function returns always the map set on the GridMap node and not the map on the NavigationServer. If the map is changed directly with the NavigationServer API the GridMap node will not be aware of the map change.
  323. .. rst-class:: classref-item-separator
  324. ----
  325. .. _class_GridMap_method_get_orthogonal_index_from_basis:
  326. .. rst-class:: classref-method
  327. :ref:`int<class_int>` **get_orthogonal_index_from_basis**\ (\ basis\: :ref:`Basis<class_Basis>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_orthogonal_index_from_basis>`
  328. This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1, 0, or 1, and returns the index (in the range from 0 to 23) of the point best representing the orientation of the object. For further details, refer to the Godot source code.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_GridMap_method_get_used_cells:
  332. .. rst-class:: classref-method
  333. :ref:`Array<class_Array>`\[:ref:`Vector3i<class_Vector3i>`\] **get_used_cells**\ (\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_used_cells>`
  334. Returns an array of :ref:`Vector3<class_Vector3>` with the non-empty cell coordinates in the grid map.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _class_GridMap_method_get_used_cells_by_item:
  338. .. rst-class:: classref-method
  339. :ref:`Array<class_Array>`\[:ref:`Vector3i<class_Vector3i>`\] **get_used_cells_by_item**\ (\ item\: :ref:`int<class_int>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_get_used_cells_by_item>`
  340. Returns an array of all cells with the given item index specified in ``item``.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_GridMap_method_local_to_map:
  344. .. rst-class:: classref-method
  345. :ref:`Vector3i<class_Vector3i>` **local_to_map**\ (\ local_position\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_local_to_map>`
  346. Returns the map coordinates of the cell containing the given ``local_position``. If ``local_position`` is in global coordinates, consider using :ref:`Node3D.to_local<class_Node3D_method_to_local>` before passing it to this method. See also :ref:`map_to_local<class_GridMap_method_map_to_local>`.
  347. .. rst-class:: classref-item-separator
  348. ----
  349. .. _class_GridMap_method_make_baked_meshes:
  350. .. rst-class:: classref-method
  351. |void| **make_baked_meshes**\ (\ gen_lightmap_uv\: :ref:`bool<class_bool>` = false, lightmap_uv_texel_size\: :ref:`float<class_float>` = 0.1\ ) :ref:`๐Ÿ”—<class_GridMap_method_make_baked_meshes>`
  352. Bakes lightmap data for all meshes in the assigned :ref:`MeshLibrary<class_MeshLibrary>`.
  353. .. rst-class:: classref-item-separator
  354. ----
  355. .. _class_GridMap_method_map_to_local:
  356. .. rst-class:: classref-method
  357. :ref:`Vector3<class_Vector3>` **map_to_local**\ (\ map_position\: :ref:`Vector3i<class_Vector3i>`\ ) |const| :ref:`๐Ÿ”—<class_GridMap_method_map_to_local>`
  358. Returns the position of a grid cell in the GridMap's local coordinate space. To convert the returned value into global coordinates, use :ref:`Node3D.to_global<class_Node3D_method_to_global>`. See also :ref:`local_to_map<class_GridMap_method_local_to_map>`.
  359. .. rst-class:: classref-item-separator
  360. ----
  361. .. _class_GridMap_method_resource_changed:
  362. .. rst-class:: classref-method
  363. |void| **resource_changed**\ (\ resource\: :ref:`Resource<class_Resource>`\ ) :ref:`๐Ÿ”—<class_GridMap_method_resource_changed>`
  364. **Deprecated:** Use :ref:`Resource.changed<class_Resource_signal_changed>` instead.
  365. This method does nothing.
  366. .. rst-class:: classref-item-separator
  367. ----
  368. .. _class_GridMap_method_set_cell_item:
  369. .. rst-class:: classref-method
  370. |void| **set_cell_item**\ (\ position\: :ref:`Vector3i<class_Vector3i>`, item\: :ref:`int<class_int>`, orientation\: :ref:`int<class_int>` = 0\ ) :ref:`๐Ÿ”—<class_GridMap_method_set_cell_item>`
  371. Sets the mesh index for the cell referenced by its grid coordinates.
  372. A negative item index such as :ref:`INVALID_CELL_ITEM<class_GridMap_constant_INVALID_CELL_ITEM>` will clear the cell.
  373. Optionally, the item's orientation can be passed. For valid orientation values, see :ref:`get_orthogonal_index_from_basis<class_GridMap_method_get_orthogonal_index_from_basis>`.
  374. .. rst-class:: classref-item-separator
  375. ----
  376. .. _class_GridMap_method_set_collision_layer_value:
  377. .. rst-class:: classref-method
  378. |void| **set_collision_layer_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_GridMap_method_set_collision_layer_value>`
  379. Based on ``value``, enables or disables the specified layer in the :ref:`collision_layer<class_GridMap_property_collision_layer>`, given a ``layer_number`` between 1 and 32.
  380. .. rst-class:: classref-item-separator
  381. ----
  382. .. _class_GridMap_method_set_collision_mask_value:
  383. .. rst-class:: classref-method
  384. |void| **set_collision_mask_value**\ (\ layer_number\: :ref:`int<class_int>`, value\: :ref:`bool<class_bool>`\ ) :ref:`๐Ÿ”—<class_GridMap_method_set_collision_mask_value>`
  385. Based on ``value``, enables or disables the specified layer in the :ref:`collision_mask<class_GridMap_property_collision_mask>`, given a ``layer_number`` between 1 and 32.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_GridMap_method_set_navigation_map:
  389. .. rst-class:: classref-method
  390. |void| **set_navigation_map**\ (\ navigation_map\: :ref:`RID<class_RID>`\ ) :ref:`๐Ÿ”—<class_GridMap_method_set_navigation_map>`
  391. Sets the :ref:`RID<class_RID>` of the navigation map this GridMap node should use for its cell baked navigation meshes.
  392. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  393. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  394. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  395. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  396. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  397. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  398. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  399. .. |void| replace:: :abbr:`void (No return value.)`