Spatial.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Spatial" inherits="Node" category="Core" version="3.1">
  3. <brief_description>
  4. Most basic 3D game object, parent of all 3D related nodes.
  5. </brief_description>
  6. <description>
  7. Most basic 3D game object, with a 3D [Transform] and visibility settings. All other 3D game objects inherit from Spatial. Use [code]Spatial[/code] as a parent node to move, scale, rotate and show/hide children in a 3D project.
  8. Affine operations (rotate, scale, translate) happen in parent's local coordinate system, unless the [code]Spatial[/code] object is set as top level. Affine operations in this coordinate system correspond to direct affine operations on the [code]Spatial[/code]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [code]Spatial[/code] object itself is referred to as object-local coordinate system.
  9. </description>
  10. <tutorials>
  11. <link>https://docs.godotengine.org/en/latest/tutorials/3d/introduction_to_3d.html</link>
  12. </tutorials>
  13. <demos>
  14. </demos>
  15. <methods>
  16. <method name="force_update_transform">
  17. <return type="void">
  18. </return>
  19. <description>
  20. </description>
  21. </method>
  22. <method name="get_parent_spatial" qualifiers="const">
  23. <return type="Spatial">
  24. </return>
  25. <description>
  26. Returns the parent [code]Spatial[/code], or an empty [Object] if no parent exists or parent is not of type [code]Spatial[/code].
  27. </description>
  28. </method>
  29. <method name="get_world" qualifiers="const">
  30. <return type="World">
  31. </return>
  32. <description>
  33. Returns the current [World] resource this [code]Spatial[/code] node is registered to.
  34. </description>
  35. </method>
  36. <method name="global_rotate">
  37. <return type="void">
  38. </return>
  39. <argument index="0" name="axis" type="Vector3">
  40. </argument>
  41. <argument index="1" name="angle" type="float">
  42. </argument>
  43. <description>
  44. Rotates the global (world) transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in global coordinate system.
  45. </description>
  46. </method>
  47. <method name="global_scale">
  48. <return type="void">
  49. </return>
  50. <argument index="0" name="scale" type="Vector3">
  51. </argument>
  52. <description>
  53. </description>
  54. </method>
  55. <method name="global_translate">
  56. <return type="void">
  57. </return>
  58. <argument index="0" name="offset" type="Vector3">
  59. </argument>
  60. <description>
  61. Moves the global (world) transformation by [Vector3] offset. The offset is in global coordinate system.
  62. </description>
  63. </method>
  64. <method name="hide">
  65. <return type="void">
  66. </return>
  67. <description>
  68. Disables rendering of this node. Changes [member visible] to [code]false[/code].
  69. </description>
  70. </method>
  71. <method name="is_local_transform_notification_enabled" qualifiers="const">
  72. <return type="bool">
  73. </return>
  74. <description>
  75. Returns whether node notifies about its local transformation changes. [code]Spatial[/code] will not propagate this by default.
  76. </description>
  77. </method>
  78. <method name="is_scale_disabled" qualifiers="const">
  79. <return type="bool">
  80. </return>
  81. <description>
  82. </description>
  83. </method>
  84. <method name="is_set_as_toplevel" qualifiers="const">
  85. <return type="bool">
  86. </return>
  87. <description>
  88. Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations.
  89. </description>
  90. </method>
  91. <method name="is_transform_notification_enabled" qualifiers="const">
  92. <return type="bool">
  93. </return>
  94. <description>
  95. Returns whether the node notifies about its global and local transformation changes. [code]Spatial[/code] will not propagate this by default.
  96. </description>
  97. </method>
  98. <method name="is_visible_in_tree" qualifiers="const">
  99. <return type="bool">
  100. </return>
  101. <description>
  102. Returns whether the node is visible, taking into consideration that its parents visibility.
  103. </description>
  104. </method>
  105. <method name="look_at">
  106. <return type="void">
  107. </return>
  108. <argument index="0" name="target" type="Vector3">
  109. </argument>
  110. <argument index="1" name="up" type="Vector3">
  111. </argument>
  112. <description>
  113. Rotates itself so that the local -Z axis points towards the [code]target[/code] position.
  114. The transform will first be rotated around the given [code]up[/code] vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the [code]target[/code] and [code]up[/code] vectors.
  115. Operations take place in global space.
  116. </description>
  117. </method>
  118. <method name="look_at_from_position">
  119. <return type="void">
  120. </return>
  121. <argument index="0" name="position" type="Vector3">
  122. </argument>
  123. <argument index="1" name="target" type="Vector3">
  124. </argument>
  125. <argument index="2" name="up" type="Vector3">
  126. </argument>
  127. <description>
  128. Moves the node to the specified [code]position[/code], and then rotates itself to point toward the [code]target[/code] as per [method look_at]. Operations take place in global space.
  129. </description>
  130. </method>
  131. <method name="orthonormalize">
  132. <return type="void">
  133. </return>
  134. <description>
  135. Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation by performing Gram-Schmidt orthonormalization on this node's [Transform].
  136. </description>
  137. </method>
  138. <method name="rotate">
  139. <return type="void">
  140. </return>
  141. <argument index="0" name="axis" type="Vector3">
  142. </argument>
  143. <argument index="1" name="angle" type="float">
  144. </argument>
  145. <description>
  146. Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians.
  147. </description>
  148. </method>
  149. <method name="rotate_object_local">
  150. <return type="void">
  151. </return>
  152. <argument index="0" name="axis" type="Vector3">
  153. </argument>
  154. <argument index="1" name="angle" type="float">
  155. </argument>
  156. <description>
  157. Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in object-local coordinate system.
  158. </description>
  159. </method>
  160. <method name="rotate_x">
  161. <return type="void">
  162. </return>
  163. <argument index="0" name="angle" type="float">
  164. </argument>
  165. <description>
  166. Rotates the local transformation around the X axis by angle in radians
  167. </description>
  168. </method>
  169. <method name="rotate_y">
  170. <return type="void">
  171. </return>
  172. <argument index="0" name="angle" type="float">
  173. </argument>
  174. <description>
  175. Rotates the local transformation around the Y axis by angle in radians.
  176. </description>
  177. </method>
  178. <method name="rotate_z">
  179. <return type="void">
  180. </return>
  181. <argument index="0" name="angle" type="float">
  182. </argument>
  183. <description>
  184. Rotates the local transformation around the Z axis by angle in radians.
  185. </description>
  186. </method>
  187. <method name="scale_object_local">
  188. <return type="void">
  189. </return>
  190. <argument index="0" name="scale" type="Vector3">
  191. </argument>
  192. <description>
  193. Scales the local transformation by given 3D scale factors in object-local coordinate system.
  194. </description>
  195. </method>
  196. <method name="set_as_toplevel">
  197. <return type="void">
  198. </return>
  199. <argument index="0" name="enable" type="bool">
  200. </argument>
  201. <description>
  202. Makes the node ignore its parents transformations. Node transformations are only in global space.
  203. </description>
  204. </method>
  205. <method name="set_disable_scale">
  206. <return type="void">
  207. </return>
  208. <argument index="0" name="disable" type="bool">
  209. </argument>
  210. <description>
  211. </description>
  212. </method>
  213. <method name="set_identity">
  214. <return type="void">
  215. </return>
  216. <description>
  217. Reset all transformations for this node. Set its [Transform] to identity matrix.
  218. </description>
  219. </method>
  220. <method name="set_ignore_transform_notification">
  221. <return type="void">
  222. </return>
  223. <argument index="0" name="enabled" type="bool">
  224. </argument>
  225. <description>
  226. Set whether the node ignores notification that its transformation (global or local) changed.
  227. </description>
  228. </method>
  229. <method name="set_notify_local_transform">
  230. <return type="void">
  231. </return>
  232. <argument index="0" name="enable" type="bool">
  233. </argument>
  234. <description>
  235. Set whether the node notifies about its local transformation changes. [code]Spatial[/code] will not propagate this by default.
  236. </description>
  237. </method>
  238. <method name="set_notify_transform">
  239. <return type="void">
  240. </return>
  241. <argument index="0" name="enable" type="bool">
  242. </argument>
  243. <description>
  244. Set whether the node notifies about its global and local transformation changes. [code]Spatial[/code] will not propagate this by default.
  245. </description>
  246. </method>
  247. <method name="show">
  248. <return type="void">
  249. </return>
  250. <description>
  251. Enables rendering of this node. Changes [member visible] to [code]true[/code].
  252. </description>
  253. </method>
  254. <method name="to_global" qualifiers="const">
  255. <return type="Vector3">
  256. </return>
  257. <argument index="0" name="local_point" type="Vector3">
  258. </argument>
  259. <description>
  260. Transforms [Vector3] "local_point" from this node's local space to world space.
  261. </description>
  262. </method>
  263. <method name="to_local" qualifiers="const">
  264. <return type="Vector3">
  265. </return>
  266. <argument index="0" name="global_point" type="Vector3">
  267. </argument>
  268. <description>
  269. Transforms [Vector3] "global_point" from world space to this node's local space.
  270. </description>
  271. </method>
  272. <method name="translate">
  273. <return type="void">
  274. </return>
  275. <argument index="0" name="offset" type="Vector3">
  276. </argument>
  277. <description>
  278. Changes the node's position by given offset [Vector3].
  279. </description>
  280. </method>
  281. <method name="translate_object_local">
  282. <return type="void">
  283. </return>
  284. <argument index="0" name="offset" type="Vector3">
  285. </argument>
  286. <description>
  287. </description>
  288. </method>
  289. <method name="update_gizmo">
  290. <return type="void">
  291. </return>
  292. <description>
  293. Updates the [SpatialGizmo] of this node.
  294. </description>
  295. </method>
  296. </methods>
  297. <members>
  298. <member name="gizmo" type="SpatialGizmo" setter="set_gizmo" getter="get_gizmo">
  299. The [SpatialGizmo] for this node. Used for example in [EditorSpatialGizmo] as custom visualization and editing handles in Editor.
  300. </member>
  301. <member name="global_transform" type="Transform" setter="set_global_transform" getter="get_global_transform">
  302. World space (global) [Transform] of this node.
  303. </member>
  304. <member name="rotation" type="Vector3" setter="set_rotation" getter="get_rotation">
  305. Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X-angle, Y-angle, Z-angle).
  306. Note that in the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three independent parameters of the Euler-angle parametrization of the rotation matrix, are stored in a [Vector3] data structure not because the rotation is a vector, but only because [Vector3] exists as a convenient data-structure to store 3 floating point numbers. Therefore, applying affine operations on the rotation "vector" is not meaningful.
  307. </member>
  308. <member name="rotation_degrees" type="Vector3" setter="set_rotation_degrees" getter="get_rotation_degrees">
  309. Rotation part of the local transformation in degrees, specified in terms of YXZ-Euler angles in the format (X-angle, Y-angle, Z-angle).
  310. </member>
  311. <member name="scale" type="Vector3" setter="set_scale" getter="get_scale">
  312. Scale part of the local transformation.
  313. </member>
  314. <member name="transform" type="Transform" setter="set_transform" getter="get_transform">
  315. Local space [Transform] of this node, with respect to the parent node.
  316. </member>
  317. <member name="translation" type="Vector3" setter="set_translation" getter="get_translation">
  318. Local translation of this node.
  319. </member>
  320. <member name="visible" type="bool" setter="set_visible" getter="is_visible">
  321. If [code]true[/code], this node is drawn. Default value: [code]true[/code].
  322. </member>
  323. </members>
  324. <signals>
  325. <signal name="visibility_changed">
  326. <description>
  327. Emitted when node visibility changes.
  328. </description>
  329. </signal>
  330. </signals>
  331. <constants>
  332. <constant name="NOTIFICATION_TRANSFORM_CHANGED" value="29">
  333. Spatial nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform.
  334. In order for [code]NOTIFICATION_TRANSFORM_CHANGED[/code] to work, users first need to ask for it, with [method set_notify_transform].
  335. </constant>
  336. <constant name="NOTIFICATION_ENTER_WORLD" value="41">
  337. Spatial nodes receives this notification when they are registered to new [World] resource.
  338. </constant>
  339. <constant name="NOTIFICATION_EXIT_WORLD" value="42">
  340. Spatial nodes receives this notification when they are unregistered from current [World] resource.
  341. </constant>
  342. <constant name="NOTIFICATION_VISIBILITY_CHANGED" value="43">
  343. Spatial nodes receives this notification when their visibility changes.
  344. </constant>
  345. </constants>
  346. </class>