GridMap.xml 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="GridMap" inherits="Spatial" category="Core" version="3.1">
  3. <brief_description>
  4. Node for 3D tile-based maps.
  5. </brief_description>
  6. <description>
  7. GridMap lets you place meshes on a grid interactively. It works both from the editor and can help you create in-game level editors.
  8. GridMaps use a [MeshLibrary] which contain a list of tiles: meshes with materials plus optional collisions and extra elements.
  9. A GridMap contains a collection of cells. Each grid cell refers to a [MeshLibrary] item. All cells in the map have the same dimensions.
  10. 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.
  11. </description>
  12. <tutorials>
  13. <link>https://docs.godotengine.org/en/latest/tutorials/3d/using_gridmaps.html</link>
  14. </tutorials>
  15. <demos>
  16. </demos>
  17. <methods>
  18. <method name="clear">
  19. <return type="void">
  20. </return>
  21. <description>
  22. Clear all cells.
  23. </description>
  24. </method>
  25. <method name="clear_baked_meshes">
  26. <return type="void">
  27. </return>
  28. <description>
  29. </description>
  30. </method>
  31. <method name="get_bake_mesh_instance">
  32. <return type="RID">
  33. </return>
  34. <argument index="0" name="idx" type="int">
  35. </argument>
  36. <description>
  37. </description>
  38. </method>
  39. <method name="get_bake_meshes">
  40. <return type="Array">
  41. </return>
  42. <description>
  43. </description>
  44. </method>
  45. <method name="get_cell_item" qualifiers="const">
  46. <return type="int">
  47. </return>
  48. <argument index="0" name="x" type="int">
  49. </argument>
  50. <argument index="1" name="y" type="int">
  51. </argument>
  52. <argument index="2" name="z" type="int">
  53. </argument>
  54. <description>
  55. The [MeshLibrary] item index located at the grid-based X, Y and Z coordinates. If the cell is empty, [INVALID_CELL_ITEM] will be returned.
  56. </description>
  57. </method>
  58. <method name="get_cell_item_orientation" qualifiers="const">
  59. <return type="int">
  60. </return>
  61. <argument index="0" name="x" type="int">
  62. </argument>
  63. <argument index="1" name="y" type="int">
  64. </argument>
  65. <argument index="2" name="z" type="int">
  66. </argument>
  67. <description>
  68. The orientation of the cell at the grid-based X, Y and Z coordinates. -1 is returned if the cell is empty.
  69. </description>
  70. </method>
  71. <method name="get_collision_layer_bit" qualifiers="const">
  72. <return type="bool">
  73. </return>
  74. <argument index="0" name="bit" type="int">
  75. </argument>
  76. <description>
  77. </description>
  78. </method>
  79. <method name="get_collision_mask_bit" qualifiers="const">
  80. <return type="bool">
  81. </return>
  82. <argument index="0" name="bit" type="int">
  83. </argument>
  84. <description>
  85. </description>
  86. </method>
  87. <method name="get_meshes">
  88. <return type="Array">
  89. </return>
  90. <description>
  91. Array of [Transform] and [Mesh] references corresponding to the non empty cells in the grid. The transforms are specified in world space.
  92. </description>
  93. </method>
  94. <method name="get_used_cells" qualifiers="const">
  95. <return type="Array">
  96. </return>
  97. <description>
  98. Array of [Vector3] with the non empty cell coordinates in the grid map.
  99. </description>
  100. </method>
  101. <method name="make_baked_meshes">
  102. <return type="void">
  103. </return>
  104. <argument index="0" name="gen_lightmap_uv" type="bool" default="false">
  105. </argument>
  106. <argument index="1" name="lightmap_uv_texel_size" type="float" default="0.1">
  107. </argument>
  108. <description>
  109. </description>
  110. </method>
  111. <method name="map_to_world" qualifiers="const">
  112. <return type="Vector3">
  113. </return>
  114. <argument index="0" name="x" type="int">
  115. </argument>
  116. <argument index="1" name="y" type="int">
  117. </argument>
  118. <argument index="2" name="z" type="int">
  119. </argument>
  120. <description>
  121. </description>
  122. </method>
  123. <method name="resource_changed">
  124. <return type="void">
  125. </return>
  126. <argument index="0" name="resource" type="Resource">
  127. </argument>
  128. <description>
  129. </description>
  130. </method>
  131. <method name="set_cell_item">
  132. <return type="void">
  133. </return>
  134. <argument index="0" name="x" type="int">
  135. </argument>
  136. <argument index="1" name="y" type="int">
  137. </argument>
  138. <argument index="2" name="z" type="int">
  139. </argument>
  140. <argument index="3" name="item" type="int">
  141. </argument>
  142. <argument index="4" name="orientation" type="int" default="0">
  143. </argument>
  144. <description>
  145. Set the mesh index for the cell referenced by its grid-based X, Y and Z coordinates.
  146. A negative item index will clear the cell.
  147. Optionally, the item's orientation can be passed.
  148. </description>
  149. </method>
  150. <method name="set_clip">
  151. <return type="void">
  152. </return>
  153. <argument index="0" name="enabled" type="bool">
  154. </argument>
  155. <argument index="1" name="clipabove" type="bool" default="true">
  156. </argument>
  157. <argument index="2" name="floor" type="int" default="0">
  158. </argument>
  159. <argument index="3" name="axis" type="int" enum="Vector3.Axis" default="0">
  160. </argument>
  161. <description>
  162. </description>
  163. </method>
  164. <method name="set_collision_layer_bit">
  165. <return type="void">
  166. </return>
  167. <argument index="0" name="bit" type="int">
  168. </argument>
  169. <argument index="1" name="value" type="bool">
  170. </argument>
  171. <description>
  172. </description>
  173. </method>
  174. <method name="set_collision_mask_bit">
  175. <return type="void">
  176. </return>
  177. <argument index="0" name="bit" type="int">
  178. </argument>
  179. <argument index="1" name="value" type="bool">
  180. </argument>
  181. <description>
  182. </description>
  183. </method>
  184. <method name="world_to_map" qualifiers="const">
  185. <return type="Vector3">
  186. </return>
  187. <argument index="0" name="pos" type="Vector3">
  188. </argument>
  189. <description>
  190. </description>
  191. </method>
  192. </methods>
  193. <members>
  194. <member name="cell_center_x" type="bool" setter="set_center_x" getter="get_center_x">
  195. If [code]true[/code], grid items are centered on the X axis.
  196. </member>
  197. <member name="cell_center_y" type="bool" setter="set_center_y" getter="get_center_y">
  198. If [code]true[/code], grid items are centered on the Y axis.
  199. </member>
  200. <member name="cell_center_z" type="bool" setter="set_center_z" getter="get_center_z">
  201. If [code]true[/code], grid items are centered on the Z axis.
  202. </member>
  203. <member name="cell_octant_size" type="int" setter="set_octant_size" getter="get_octant_size">
  204. The size of each octant measured in number of cells. This applies to all three axis.
  205. </member>
  206. <member name="cell_scale" type="float" setter="set_cell_scale" getter="get_cell_scale">
  207. </member>
  208. <member name="cell_size" type="Vector3" setter="set_cell_size" getter="get_cell_size">
  209. The dimensions of the grid's cells.
  210. </member>
  211. <member name="collision_layer" type="int" setter="set_collision_layer" getter="get_collision_layer">
  212. </member>
  213. <member name="collision_mask" type="int" setter="set_collision_mask" getter="get_collision_mask">
  214. </member>
  215. <member name="mesh_library" type="MeshLibrary" setter="set_mesh_library" getter="get_mesh_library">
  216. The assigned [MeshLibrary].
  217. </member>
  218. <member name="theme" type="MeshLibrary" setter="set_theme" getter="get_theme">
  219. Deprecated, use [member mesh_library] instead.
  220. </member>
  221. </members>
  222. <constants>
  223. <constant name="INVALID_CELL_ITEM" value="-1">
  224. Invalid cell item that can be used in [method set_cell_item] to clear cells (or represent an empty cell in [method get_cell_item]).
  225. </constant>
  226. </constants>
  227. </class>