class_spatial.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the doc/base/classes.xml source instead.
  3. .. _class_Spatial:
  4. Spatial
  5. =======
  6. **Inherits:** :ref:`Node<class_node>` **<** :ref:`Object<class_object>`
  7. **Inherited By:** :ref:`Joint<class_joint>`, :ref:`RayCast<class_raycast>`, :ref:`Camera<class_camera>`, :ref:`BoneAttachment<class_boneattachment>`, :ref:`CollisionShape<class_collisionshape>`, :ref:`Path<class_path>`, :ref:`VisualInstance<class_visualinstance>`, :ref:`VehicleWheel<class_vehiclewheel>`, :ref:`Position3D<class_position3d>`, :ref:`ProximityGroup<class_proximitygroup>`, :ref:`SpatialPlayer<class_spatialplayer>`, :ref:`WorldEnvironment<class_worldenvironment>`, :ref:`PathFollow<class_pathfollow>`, :ref:`NavigationMeshInstance<class_navigationmeshinstance>`, :ref:`VisibilityNotifier<class_visibilitynotifier>`, :ref:`Navigation<class_navigation>`, :ref:`CollisionPolygon<class_collisionpolygon>`, :ref:`GridMap<class_gridmap>`, :ref:`Skeleton<class_skeleton>`, :ref:`CollisionObject<class_collisionobject>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. Base class for all 3D nodes.
  12. Member Functions
  13. ----------------
  14. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`set_transform<class_Spatial_set_transform>` **(** :ref:`Transform<class_transform>` local **)** |
  16. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Transform<class_transform>` | :ref:`get_transform<class_Spatial_get_transform>` **(** **)** const |
  18. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | void | :ref:`set_translation<class_Spatial_set_translation>` **(** :ref:`Vector3<class_vector3>` translation **)** |
  20. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Vector3<class_vector3>` | :ref:`get_translation<class_Spatial_get_translation>` **(** **)** const |
  22. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | void | :ref:`set_rotation<class_Spatial_set_rotation>` **(** :ref:`Vector3<class_vector3>` rotation_rad **)** |
  24. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Vector3<class_vector3>` | :ref:`get_rotation<class_Spatial_get_rotation>` **(** **)** const |
  26. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | void | :ref:`set_rotation_deg<class_Spatial_set_rotation_deg>` **(** :ref:`Vector3<class_vector3>` rotation_deg **)** |
  28. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Vector3<class_vector3>` | :ref:`get_rotation_deg<class_Spatial_get_rotation_deg>` **(** **)** const |
  30. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_scale<class_Spatial_set_scale>` **(** :ref:`Vector3<class_vector3>` scale **)** |
  32. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | :ref:`Vector3<class_vector3>` | :ref:`get_scale<class_Spatial_get_scale>` **(** **)** const |
  34. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_global_transform<class_Spatial_set_global_transform>` **(** :ref:`Transform<class_transform>` global **)** |
  36. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | :ref:`Transform<class_transform>` | :ref:`get_global_transform<class_Spatial_get_global_transform>` **(** **)** const |
  38. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`Object<class_object>` | :ref:`get_parent_spatial<class_Spatial_get_parent_spatial>` **(** **)** const |
  40. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | void | :ref:`set_ignore_transform_notification<class_Spatial_set_ignore_transform_notification>` **(** :ref:`bool<class_bool>` enabled **)** |
  42. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | void | :ref:`set_as_toplevel<class_Spatial_set_as_toplevel>` **(** :ref:`bool<class_bool>` enable **)** |
  44. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`is_set_as_toplevel<class_Spatial_is_set_as_toplevel>` **(** **)** const |
  46. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | :ref:`World<class_world>` | :ref:`get_world<class_Spatial_get_world>` **(** **)** const |
  48. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | void | :ref:`update_gizmo<class_Spatial_update_gizmo>` **(** **)** |
  50. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`set_gizmo<class_Spatial_set_gizmo>` **(** SpatialGizmo gizmo **)** |
  52. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | SpatialGizmo | :ref:`get_gizmo<class_Spatial_get_gizmo>` **(** **)** const |
  54. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`show<class_Spatial_show>` **(** **)** |
  56. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`hide<class_Spatial_hide>` **(** **)** |
  58. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | :ref:`bool<class_bool>` | :ref:`is_visible<class_Spatial_is_visible>` **(** **)** const |
  60. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`bool<class_bool>` | :ref:`is_hidden<class_Spatial_is_hidden>` **(** **)** const |
  62. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_hidden<class_Spatial_set_hidden>` **(** :ref:`bool<class_bool>` hidden **)** |
  64. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`set_notify_local_transform<class_Spatial_set_notify_local_transform>` **(** :ref:`bool<class_bool>` enable **)** |
  66. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | :ref:`bool<class_bool>` | :ref:`is_local_transform_notification_enabled<class_Spatial_is_local_transform_notification_enabled>` **(** **)** const |
  68. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`rotate<class_Spatial_rotate>` **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)** |
  70. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`global_rotate<class_Spatial_global_rotate>` **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)** |
  72. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`rotate_x<class_Spatial_rotate_x>` **(** :ref:`float<class_float>` radians **)** |
  74. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`rotate_y<class_Spatial_rotate_y>` **(** :ref:`float<class_float>` radians **)** |
  76. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`rotate_z<class_Spatial_rotate_z>` **(** :ref:`float<class_float>` radians **)** |
  78. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`translate<class_Spatial_translate>` **(** :ref:`Vector3<class_vector3>` offset **)** |
  80. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`global_translate<class_Spatial_global_translate>` **(** :ref:`Vector3<class_vector3>` offset **)** |
  82. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`orthonormalize<class_Spatial_orthonormalize>` **(** **)** |
  84. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`set_identity<class_Spatial_set_identity>` **(** **)** |
  86. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`look_at<class_Spatial_look_at>` **(** :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)** |
  88. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`look_at_from_pos<class_Spatial_look_at_from_pos>` **(** :ref:`Vector3<class_vector3>` pos, :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)** |
  90. +------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  91. Signals
  92. -------
  93. - **visibility_changed** **(** **)**
  94. Numeric Constants
  95. -----------------
  96. - **NOTIFICATION_TRANSFORM_CHANGED** = **29** --- Spatial nodes receive this notification with their global transform changes. This means that either the current or a parent node changed its transform.
  97. - **NOTIFICATION_ENTER_WORLD** = **41**
  98. - **NOTIFICATION_EXIT_WORLD** = **42**
  99. - **NOTIFICATION_VISIBILITY_CHANGED** = **43**
  100. Description
  101. -----------
  102. Spatial is the base for every type of 3D :ref:`Node<class_node>`. It contains a 3D :ref:`Transform<class_transform>` which can be set or get as local or global. If a Spatial :ref:`Node<class_node>` has Spatial children, their transforms will be relative to the parent.
  103. Member Function Description
  104. ---------------------------
  105. .. _class_Spatial_set_transform:
  106. - void **set_transform** **(** :ref:`Transform<class_transform>` local **)**
  107. Set the transform locally, relative to the parent spatial node.
  108. .. _class_Spatial_get_transform:
  109. - :ref:`Transform<class_transform>` **get_transform** **(** **)** const
  110. Return the local transform, relative to the bone parent.
  111. .. _class_Spatial_set_translation:
  112. - void **set_translation** **(** :ref:`Vector3<class_vector3>` translation **)**
  113. .. _class_Spatial_get_translation:
  114. - :ref:`Vector3<class_vector3>` **get_translation** **(** **)** const
  115. .. _class_Spatial_set_rotation:
  116. - void **set_rotation** **(** :ref:`Vector3<class_vector3>` rotation_rad **)**
  117. .. _class_Spatial_get_rotation:
  118. - :ref:`Vector3<class_vector3>` **get_rotation** **(** **)** const
  119. .. _class_Spatial_set_rotation_deg:
  120. - void **set_rotation_deg** **(** :ref:`Vector3<class_vector3>` rotation_deg **)**
  121. .. _class_Spatial_get_rotation_deg:
  122. - :ref:`Vector3<class_vector3>` **get_rotation_deg** **(** **)** const
  123. .. _class_Spatial_set_scale:
  124. - void **set_scale** **(** :ref:`Vector3<class_vector3>` scale **)**
  125. .. _class_Spatial_get_scale:
  126. - :ref:`Vector3<class_vector3>` **get_scale** **(** **)** const
  127. .. _class_Spatial_set_global_transform:
  128. - void **set_global_transform** **(** :ref:`Transform<class_transform>` global **)**
  129. Set the transform globally, relative to worldspace.
  130. .. _class_Spatial_get_global_transform:
  131. - :ref:`Transform<class_transform>` **get_global_transform** **(** **)** const
  132. Return the global transform, relative to worldspace.
  133. .. _class_Spatial_get_parent_spatial:
  134. - :ref:`Object<class_object>` **get_parent_spatial** **(** **)** const
  135. Return the parent :ref:`Spatial<class_spatial>`, or an empty :ref:`Object<class_object>` if no parent exists or parent is not of type :ref:`Spatial<class_spatial>`.
  136. .. _class_Spatial_set_ignore_transform_notification:
  137. - void **set_ignore_transform_notification** **(** :ref:`bool<class_bool>` enabled **)**
  138. .. _class_Spatial_set_as_toplevel:
  139. - void **set_as_toplevel** **(** :ref:`bool<class_bool>` enable **)**
  140. .. _class_Spatial_is_set_as_toplevel:
  141. - :ref:`bool<class_bool>` **is_set_as_toplevel** **(** **)** const
  142. .. _class_Spatial_get_world:
  143. - :ref:`World<class_world>` **get_world** **(** **)** const
  144. .. _class_Spatial_update_gizmo:
  145. - void **update_gizmo** **(** **)**
  146. .. _class_Spatial_set_gizmo:
  147. - void **set_gizmo** **(** SpatialGizmo gizmo **)**
  148. .. _class_Spatial_get_gizmo:
  149. - SpatialGizmo **get_gizmo** **(** **)** const
  150. .. _class_Spatial_show:
  151. - void **show** **(** **)**
  152. .. _class_Spatial_hide:
  153. - void **hide** **(** **)**
  154. .. _class_Spatial_is_visible:
  155. - :ref:`bool<class_bool>` **is_visible** **(** **)** const
  156. .. _class_Spatial_is_hidden:
  157. - :ref:`bool<class_bool>` **is_hidden** **(** **)** const
  158. .. _class_Spatial_set_hidden:
  159. - void **set_hidden** **(** :ref:`bool<class_bool>` hidden **)**
  160. .. _class_Spatial_set_notify_local_transform:
  161. - void **set_notify_local_transform** **(** :ref:`bool<class_bool>` enable **)**
  162. .. _class_Spatial_is_local_transform_notification_enabled:
  163. - :ref:`bool<class_bool>` **is_local_transform_notification_enabled** **(** **)** const
  164. .. _class_Spatial_rotate:
  165. - void **rotate** **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)**
  166. .. _class_Spatial_global_rotate:
  167. - void **global_rotate** **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)**
  168. .. _class_Spatial_rotate_x:
  169. - void **rotate_x** **(** :ref:`float<class_float>` radians **)**
  170. .. _class_Spatial_rotate_y:
  171. - void **rotate_y** **(** :ref:`float<class_float>` radians **)**
  172. .. _class_Spatial_rotate_z:
  173. - void **rotate_z** **(** :ref:`float<class_float>` radians **)**
  174. .. _class_Spatial_translate:
  175. - void **translate** **(** :ref:`Vector3<class_vector3>` offset **)**
  176. .. _class_Spatial_global_translate:
  177. - void **global_translate** **(** :ref:`Vector3<class_vector3>` offset **)**
  178. .. _class_Spatial_orthonormalize:
  179. - void **orthonormalize** **(** **)**
  180. .. _class_Spatial_set_identity:
  181. - void **set_identity** **(** **)**
  182. .. _class_Spatial_look_at:
  183. - void **look_at** **(** :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)**
  184. .. _class_Spatial_look_at_from_pos:
  185. - void **look_at_from_pos** **(** :ref:`Vector3<class_vector3>` pos, :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)**