Node3D.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="Node3D" inherits="Node" version="4.0">
  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 [Transform3D] and visibility settings. All other 3D game objects inherit from Node3D. Use [Node3D] 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 [Node3D] object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the [Node3D]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [Node3D] object itself is referred to as object-local coordinate system.
  9. [b]Note:[/b] Unless otherwise specified, all methods that have angle parameters must have angles specified as [i]radians[/i]. To convert degrees to radians, use [method @GlobalScope.deg2rad].
  10. </description>
  11. <tutorials>
  12. <link title="Introduction to 3D">https://docs.godotengine.org/en/latest/tutorials/3d/introduction_to_3d.html</link>
  13. <link title="All 3D Demos">https://github.com/godotengine/godot-demo-projects/tree/master/3d</link>
  14. </tutorials>
  15. <methods>
  16. <method name="add_gizmo">
  17. <return type="void" />
  18. <argument index="0" name="gizmo" type="Node3DGizmo" />
  19. <description>
  20. Attach a gizmo to this [code]Node3D[/code].
  21. </description>
  22. </method>
  23. <method name="clear_gizmos">
  24. <return type="void" />
  25. <description>
  26. Clear all gizmos attached to this [code]Node3D[/code].
  27. </description>
  28. </method>
  29. <method name="clear_subgizmo_selection">
  30. <return type="void" />
  31. <description>
  32. Clears subgizmo selection for this node in the editor. Useful when subgizmo IDs become invalid after a property change.
  33. </description>
  34. </method>
  35. <method name="force_update_transform">
  36. <return type="void" />
  37. <description>
  38. Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
  39. </description>
  40. </method>
  41. <method name="get_gizmos" qualifiers="const">
  42. <return type="Array" />
  43. <description>
  44. Returns all the gizmos attached to this [code]Node3D[/code].
  45. </description>
  46. </method>
  47. <method name="get_parent_node_3d" qualifiers="const">
  48. <return type="Node3D" />
  49. <description>
  50. Returns the parent [Node3D], or an empty [Object] if no parent exists or parent is not of type [Node3D].
  51. </description>
  52. </method>
  53. <method name="get_world_3d" qualifiers="const">
  54. <return type="World3D" />
  55. <description>
  56. Returns the current [World3D] resource this [Node3D] node is registered to.
  57. </description>
  58. </method>
  59. <method name="global_rotate">
  60. <return type="void" />
  61. <argument index="0" name="axis" type="Vector3" />
  62. <argument index="1" name="angle" type="float" />
  63. <description>
  64. Rotates the global (world) transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in global coordinate system.
  65. </description>
  66. </method>
  67. <method name="global_scale">
  68. <return type="void" />
  69. <argument index="0" name="scale" type="Vector3" />
  70. <description>
  71. Scales the global (world) transformation by the given [Vector3] scale factors.
  72. </description>
  73. </method>
  74. <method name="global_translate">
  75. <return type="void" />
  76. <argument index="0" name="offset" type="Vector3" />
  77. <description>
  78. Moves the global (world) transformation by [Vector3] offset. The offset is in global coordinate system.
  79. </description>
  80. </method>
  81. <method name="hide">
  82. <return type="void" />
  83. <description>
  84. Disables rendering of this node. Changes [member visible] to [code]false[/code].
  85. </description>
  86. </method>
  87. <method name="is_local_transform_notification_enabled" qualifiers="const">
  88. <return type="bool" />
  89. <description>
  90. Returns whether node notifies about its local transformation changes. [Node3D] will not propagate this by default.
  91. </description>
  92. </method>
  93. <method name="is_scale_disabled" qualifiers="const">
  94. <return type="bool" />
  95. <description>
  96. Returns whether this node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale.
  97. </description>
  98. </method>
  99. <method name="is_transform_notification_enabled" qualifiers="const">
  100. <return type="bool" />
  101. <description>
  102. Returns whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default.
  103. </description>
  104. </method>
  105. <method name="is_visible_in_tree" qualifiers="const">
  106. <return type="bool" />
  107. <description>
  108. Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its antecedents are also visible. If any antecedent is hidden, this node will not be visible in the scene tree.
  109. </description>
  110. </method>
  111. <method name="look_at">
  112. <return type="void" />
  113. <argument index="0" name="target" type="Vector3" />
  114. <argument index="1" name="up" type="Vector3" default="Vector3(0, 1, 0)" />
  115. <description>
  116. Rotates the node so that the local forward axis (-Z) points toward the [code]target[/code] position.
  117. The local up axis (+Y) points as close to the [code]up[/code] vector as possible while staying perpendicular to the local forward axis. The resulting transform is orthogonal, and the scale is preserved. Non-uniform scaling may not work correctly.
  118. The [code]target[/code] position cannot be the same as the node's position, the [code]up[/code] vector cannot be zero, and the direction from the node's position to the [code]target[/code] vector cannot be parallel to the [code]up[/code] vector.
  119. Operations take place in global space.
  120. </description>
  121. </method>
  122. <method name="look_at_from_position">
  123. <return type="void" />
  124. <argument index="0" name="position" type="Vector3" />
  125. <argument index="1" name="target" type="Vector3" />
  126. <argument index="2" name="up" type="Vector3" default="Vector3(0, 1, 0)" />
  127. <description>
  128. Moves the node to the specified [code]position[/code], and then rotates the node 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. <description>
  134. Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation by performing Gram-Schmidt orthonormalization on this node's [Transform3D].
  135. </description>
  136. </method>
  137. <method name="rotate">
  138. <return type="void" />
  139. <argument index="0" name="axis" type="Vector3" />
  140. <argument index="1" name="angle" type="float" />
  141. <description>
  142. Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians.
  143. </description>
  144. </method>
  145. <method name="rotate_object_local">
  146. <return type="void" />
  147. <argument index="0" name="axis" type="Vector3" />
  148. <argument index="1" name="angle" type="float" />
  149. <description>
  150. Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in object-local coordinate system.
  151. </description>
  152. </method>
  153. <method name="rotate_x">
  154. <return type="void" />
  155. <argument index="0" name="angle" type="float" />
  156. <description>
  157. Rotates the local transformation around the X axis by angle in radians.
  158. </description>
  159. </method>
  160. <method name="rotate_y">
  161. <return type="void" />
  162. <argument index="0" name="angle" type="float" />
  163. <description>
  164. Rotates the local transformation around the Y axis by angle in radians.
  165. </description>
  166. </method>
  167. <method name="rotate_z">
  168. <return type="void" />
  169. <argument index="0" name="angle" type="float" />
  170. <description>
  171. Rotates the local transformation around the Z axis by angle in radians.
  172. </description>
  173. </method>
  174. <method name="scale_object_local">
  175. <return type="void" />
  176. <argument index="0" name="scale" type="Vector3" />
  177. <description>
  178. Scales the local transformation by given 3D scale factors in object-local coordinate system.
  179. </description>
  180. </method>
  181. <method name="set_disable_scale">
  182. <return type="void" />
  183. <argument index="0" name="disable" type="bool" />
  184. <description>
  185. Sets whether the node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale. Changes to the local transformation scale are preserved.
  186. </description>
  187. </method>
  188. <method name="set_identity">
  189. <return type="void" />
  190. <description>
  191. Reset all transformations for this node (sets its [Transform3D] to the identity matrix).
  192. </description>
  193. </method>
  194. <method name="set_ignore_transform_notification">
  195. <return type="void" />
  196. <argument index="0" name="enabled" type="bool" />
  197. <description>
  198. Sets whether the node ignores notification that its transformation (global or local) changed.
  199. </description>
  200. </method>
  201. <method name="set_notify_local_transform">
  202. <return type="void" />
  203. <argument index="0" name="enable" type="bool" />
  204. <description>
  205. Sets whether the node notifies about its local transformation changes. [Node3D] will not propagate this by default.
  206. </description>
  207. </method>
  208. <method name="set_notify_transform">
  209. <return type="void" />
  210. <argument index="0" name="enable" type="bool" />
  211. <description>
  212. Sets whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default, unless it is in the editor context and it has a valid gizmo.
  213. </description>
  214. </method>
  215. <method name="set_subgizmo_selection">
  216. <return type="void" />
  217. <argument index="0" name="gizmo" type="Node3DGizmo" />
  218. <argument index="1" name="id" type="int" />
  219. <argument index="2" name="transform" type="Transform3D" />
  220. <description>
  221. Set subgizmo selection for this node in the editor.
  222. </description>
  223. </method>
  224. <method name="show">
  225. <return type="void" />
  226. <description>
  227. Enables rendering of this node. Changes [member visible] to [code]true[/code].
  228. </description>
  229. </method>
  230. <method name="to_global" qualifiers="const">
  231. <return type="Vector3" />
  232. <argument index="0" name="local_point" type="Vector3" />
  233. <description>
  234. Transforms [code]local_point[/code] from this node's local space to world space.
  235. </description>
  236. </method>
  237. <method name="to_local" qualifiers="const">
  238. <return type="Vector3" />
  239. <argument index="0" name="global_point" type="Vector3" />
  240. <description>
  241. Transforms [code]global_point[/code] from world space to this node's local space.
  242. </description>
  243. </method>
  244. <method name="translate">
  245. <return type="void" />
  246. <argument index="0" name="offset" type="Vector3" />
  247. <description>
  248. Changes the node's position by the given offset [Vector3].
  249. Note that the translation [code]offset[/code] is affected by the node's scale, so if scaled by e.g. [code](10, 1, 1)[/code], a translation by an offset of [code](2, 0, 0)[/code] would actually add 20 ([code]2 * 10[/code]) to the X coordinate.
  250. </description>
  251. </method>
  252. <method name="translate_object_local">
  253. <return type="void" />
  254. <argument index="0" name="offset" type="Vector3" />
  255. <description>
  256. Changes the node's position by the given offset [Vector3] in local space.
  257. </description>
  258. </method>
  259. <method name="update_gizmos">
  260. <return type="void" />
  261. <description>
  262. Updates all the [Node3DGizmo]s attached to this node.
  263. </description>
  264. </method>
  265. </methods>
  266. <members>
  267. <member name="basis" type="Basis" setter="set_basis" getter="get_basis">
  268. Direct access to the 3x3 basis of the [Transform3D] property.
  269. </member>
  270. <member name="global_transform" type="Transform3D" setter="set_global_transform" getter="get_global_transform">
  271. World3D space (global) [Transform3D] of this node.
  272. </member>
  273. <member name="position" type="Vector3" setter="set_position" getter="get_position" default="Vector3(0, 0, 0)">
  274. Local position or translation of this node relative to the parent. This is equivalent to [code]transform.origin[/code].
  275. </member>
  276. <member name="quaternion" type="Quaternion" setter="set_quaternion" getter="get_quaternion">
  277. Access to the node rotation as a [Quaternion]. This property is ideal for tweening complex rotations.
  278. </member>
  279. <member name="rotation" type="Vector3" setter="set_rotation" getter="get_rotation" default="Vector3(0, 0, 0)">
  280. Rotation part of the local transformation in radians, specified in terms of Euler angles. The angles construct a rotaton in the order specified by the [member rotation_order] property.
  281. [b]Note:[/b] 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.
  282. </member>
  283. <member name="rotation_edit_mode" type="int" setter="set_rotation_edit_mode" getter="get_rotation_edit_mode" enum="Node3D.RotationEditMode" default="0">
  284. Specify how rotation (and scale) will be presented in the editor.
  285. </member>
  286. <member name="rotation_order" type="int" setter="set_rotation_order" getter="get_rotation_order" enum="Node3D.RotationOrder" default="2">
  287. Specify the axis rotation order of the [member rotation] property. The final orientation is constructed by rotating the Euler angles in the order specified by this property.
  288. </member>
  289. <member name="scale" type="Vector3" setter="set_scale" getter="get_scale" default="Vector3(1, 1, 1)">
  290. Scale part of the local transformation.
  291. </member>
  292. <member name="top_level" type="bool" setter="set_as_top_level" getter="is_set_as_top_level" default="false">
  293. If [code]true[/code], the node will not inherit its transformations from its parent. Node transformations are only in global space.
  294. </member>
  295. <member name="transform" type="Transform3D" setter="set_transform" getter="get_transform" default="Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)">
  296. Local space [Transform3D] of this node, with respect to the parent node.
  297. </member>
  298. <member name="visibility_parent" type="NodePath" setter="set_visibility_parent" getter="get_visibility_parent" default="NodePath(&quot;&quot;)">
  299. Defines the visibility range parent for this node and its subtree. The visibility parent must be a GeometryInstance3D. Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependent instances will not take the hidden node or its ancestors into account.
  300. </member>
  301. <member name="visible" type="bool" setter="set_visible" getter="is_visible" default="true">
  302. If [code]true[/code], this node is drawn. The node is only visible if all of its antecedents are visible as well (in other words, [method is_visible_in_tree] must return [code]true[/code]).
  303. </member>
  304. </members>
  305. <signals>
  306. <signal name="visibility_changed">
  307. <description>
  308. Emitted when node visibility changes.
  309. </description>
  310. </signal>
  311. </signals>
  312. <constants>
  313. <constant name="NOTIFICATION_TRANSFORM_CHANGED" value="2000">
  314. Node3D nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform.
  315. In order for [constant NOTIFICATION_TRANSFORM_CHANGED] to work, users first need to ask for it, with [method set_notify_transform]. The notification is also sent if the node is in the editor context and it has at least one valid gizmo.
  316. </constant>
  317. <constant name="NOTIFICATION_ENTER_WORLD" value="41">
  318. Node3D nodes receives this notification when they are registered to new [World3D] resource.
  319. </constant>
  320. <constant name="NOTIFICATION_EXIT_WORLD" value="42">
  321. Node3D nodes receives this notification when they are unregistered from current [World3D] resource.
  322. </constant>
  323. <constant name="NOTIFICATION_VISIBILITY_CHANGED" value="43">
  324. Node3D nodes receives this notification when their visibility changes.
  325. </constant>
  326. <constant name="ROTATION_EDIT_MODE_EULER" value="0" enum="RotationEditMode">
  327. </constant>
  328. <constant name="ROTATION_EDIT_MODE_QUATERNION" value="1" enum="RotationEditMode">
  329. </constant>
  330. <constant name="ROTATION_EDIT_MODE_BASIS" value="2" enum="RotationEditMode">
  331. </constant>
  332. <constant name="ROTATION_ORDER_XYZ" value="0" enum="RotationOrder">
  333. </constant>
  334. <constant name="ROTATION_ORDER_XZY" value="1" enum="RotationOrder">
  335. </constant>
  336. <constant name="ROTATION_ORDER_YXZ" value="2" enum="RotationOrder">
  337. </constant>
  338. <constant name="ROTATION_ORDER_YZX" value="3" enum="RotationOrder">
  339. </constant>
  340. <constant name="ROTATION_ORDER_ZXY" value="4" enum="RotationOrder">
  341. </constant>
  342. <constant name="ROTATION_ORDER_ZYX" value="5" enum="RotationOrder">
  343. </constant>
  344. </constants>
  345. </class>