class_spatial.rst 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285
  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:`Listener<class_listener>`, :ref:`InverseKinematics<class_inversekinematics>`, :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. | :ref:`SpatialGizmo<class_spatialgizmo>` | :ref:`get_gizmo<class_Spatial_get_gizmo>` **(** **)** const |
  16. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`Transform<class_transform>` | :ref:`get_global_transform<class_Spatial_get_global_transform>` **(** **)** const |
  18. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`Object<class_object>` | :ref:`get_parent_spatial<class_Spatial_get_parent_spatial>` **(** **)** const |
  20. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`Vector3<class_vector3>` | :ref:`get_rotation<class_Spatial_get_rotation>` **(** **)** const |
  22. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Vector3<class_vector3>` | :ref:`get_rotation_deg<class_Spatial_get_rotation_deg>` **(** **)** const |
  24. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Vector3<class_vector3>` | :ref:`get_scale<class_Spatial_get_scale>` **(** **)** const |
  26. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`Transform<class_transform>` | :ref:`get_transform<class_Spatial_get_transform>` **(** **)** const |
  28. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`Vector3<class_vector3>` | :ref:`get_translation<class_Spatial_get_translation>` **(** **)** const |
  30. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  31. | :ref:`World<class_world>` | :ref:`get_world<class_Spatial_get_world>` **(** **)** const |
  32. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`global_rotate<class_Spatial_global_rotate>` **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)** |
  34. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`global_translate<class_Spatial_global_translate>` **(** :ref:`Vector3<class_vector3>` offset **)** |
  36. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`hide<class_Spatial_hide>` **(** **)** |
  38. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  39. | :ref:`bool<class_bool>` | :ref:`is_hidden<class_Spatial_is_hidden>` **(** **)** const |
  40. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  41. | :ref:`bool<class_bool>` | :ref:`is_local_transform_notification_enabled<class_Spatial_is_local_transform_notification_enabled>` **(** **)** const |
  42. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  43. | :ref:`bool<class_bool>` | :ref:`is_set_as_toplevel<class_Spatial_is_set_as_toplevel>` **(** **)** const |
  44. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  45. | :ref:`bool<class_bool>` | :ref:`is_visible<class_Spatial_is_visible>` **(** **)** const |
  46. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  47. | void | :ref:`look_at<class_Spatial_look_at>` **(** :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)** |
  48. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  49. | 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 **)** |
  50. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  51. | void | :ref:`orthonormalize<class_Spatial_orthonormalize>` **(** **)** |
  52. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  53. | void | :ref:`rotate<class_Spatial_rotate>` **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)** |
  54. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  55. | void | :ref:`rotate_x<class_Spatial_rotate_x>` **(** :ref:`float<class_float>` radians **)** |
  56. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  57. | void | :ref:`rotate_y<class_Spatial_rotate_y>` **(** :ref:`float<class_float>` radians **)** |
  58. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | void | :ref:`rotate_z<class_Spatial_rotate_z>` **(** :ref:`float<class_float>` radians **)** |
  60. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | void | :ref:`set_as_toplevel<class_Spatial_set_as_toplevel>` **(** :ref:`bool<class_bool>` enable **)** |
  62. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | void | :ref:`set_gizmo<class_Spatial_set_gizmo>` **(** :ref:`SpatialGizmo<class_spatialgizmo>` gizmo **)** |
  64. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | void | :ref:`set_global_transform<class_Spatial_set_global_transform>` **(** :ref:`Transform<class_transform>` global **)** |
  66. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. | void | :ref:`set_hidden<class_Spatial_set_hidden>` **(** :ref:`bool<class_bool>` hidden **)** |
  68. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  69. | void | :ref:`set_identity<class_Spatial_set_identity>` **(** **)** |
  70. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  71. | void | :ref:`set_ignore_transform_notification<class_Spatial_set_ignore_transform_notification>` **(** :ref:`bool<class_bool>` enabled **)** |
  72. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  73. | void | :ref:`set_notify_local_transform<class_Spatial_set_notify_local_transform>` **(** :ref:`bool<class_bool>` enable **)** |
  74. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  75. | void | :ref:`set_rotation<class_Spatial_set_rotation>` **(** :ref:`Vector3<class_vector3>` rotation_rad **)** |
  76. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  77. | void | :ref:`set_rotation_deg<class_Spatial_set_rotation_deg>` **(** :ref:`Vector3<class_vector3>` rotation_deg **)** |
  78. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  79. | void | :ref:`set_scale<class_Spatial_set_scale>` **(** :ref:`Vector3<class_vector3>` scale **)** |
  80. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  81. | void | :ref:`set_transform<class_Spatial_set_transform>` **(** :ref:`Transform<class_transform>` local **)** |
  82. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  83. | void | :ref:`set_translation<class_Spatial_set_translation>` **(** :ref:`Vector3<class_vector3>` translation **)** |
  84. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  85. | void | :ref:`show<class_Spatial_show>` **(** **)** |
  86. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  87. | void | :ref:`translate<class_Spatial_translate>` **(** :ref:`Vector3<class_vector3>` offset **)** |
  88. +------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  89. | void | :ref:`update_gizmo<class_Spatial_update_gizmo>` **(** **)** |
  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_get_gizmo:
  106. - :ref:`SpatialGizmo<class_spatialgizmo>` **get_gizmo** **(** **)** const
  107. .. _class_Spatial_get_global_transform:
  108. - :ref:`Transform<class_transform>` **get_global_transform** **(** **)** const
  109. Return the global transform, relative to worldspace.
  110. .. _class_Spatial_get_parent_spatial:
  111. - :ref:`Object<class_object>` **get_parent_spatial** **(** **)** const
  112. 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>`.
  113. .. _class_Spatial_get_rotation:
  114. - :ref:`Vector3<class_vector3>` **get_rotation** **(** **)** const
  115. .. _class_Spatial_get_rotation_deg:
  116. - :ref:`Vector3<class_vector3>` **get_rotation_deg** **(** **)** const
  117. .. _class_Spatial_get_scale:
  118. - :ref:`Vector3<class_vector3>` **get_scale** **(** **)** const
  119. .. _class_Spatial_get_transform:
  120. - :ref:`Transform<class_transform>` **get_transform** **(** **)** const
  121. Return the local transform, relative to the bone parent.
  122. .. _class_Spatial_get_translation:
  123. - :ref:`Vector3<class_vector3>` **get_translation** **(** **)** const
  124. .. _class_Spatial_get_world:
  125. - :ref:`World<class_world>` **get_world** **(** **)** const
  126. .. _class_Spatial_global_rotate:
  127. - void **global_rotate** **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)**
  128. .. _class_Spatial_global_translate:
  129. - void **global_translate** **(** :ref:`Vector3<class_vector3>` offset **)**
  130. .. _class_Spatial_hide:
  131. - void **hide** **(** **)**
  132. .. _class_Spatial_is_hidden:
  133. - :ref:`bool<class_bool>` **is_hidden** **(** **)** const
  134. .. _class_Spatial_is_local_transform_notification_enabled:
  135. - :ref:`bool<class_bool>` **is_local_transform_notification_enabled** **(** **)** const
  136. .. _class_Spatial_is_set_as_toplevel:
  137. - :ref:`bool<class_bool>` **is_set_as_toplevel** **(** **)** const
  138. .. _class_Spatial_is_visible:
  139. - :ref:`bool<class_bool>` **is_visible** **(** **)** const
  140. .. _class_Spatial_look_at:
  141. - void **look_at** **(** :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)**
  142. .. _class_Spatial_look_at_from_pos:
  143. - void **look_at_from_pos** **(** :ref:`Vector3<class_vector3>` pos, :ref:`Vector3<class_vector3>` target, :ref:`Vector3<class_vector3>` up **)**
  144. .. _class_Spatial_orthonormalize:
  145. - void **orthonormalize** **(** **)**
  146. .. _class_Spatial_rotate:
  147. - void **rotate** **(** :ref:`Vector3<class_vector3>` normal, :ref:`float<class_float>` radians **)**
  148. .. _class_Spatial_rotate_x:
  149. - void **rotate_x** **(** :ref:`float<class_float>` radians **)**
  150. .. _class_Spatial_rotate_y:
  151. - void **rotate_y** **(** :ref:`float<class_float>` radians **)**
  152. .. _class_Spatial_rotate_z:
  153. - void **rotate_z** **(** :ref:`float<class_float>` radians **)**
  154. .. _class_Spatial_set_as_toplevel:
  155. - void **set_as_toplevel** **(** :ref:`bool<class_bool>` enable **)**
  156. .. _class_Spatial_set_gizmo:
  157. - void **set_gizmo** **(** :ref:`SpatialGizmo<class_spatialgizmo>` gizmo **)**
  158. .. _class_Spatial_set_global_transform:
  159. - void **set_global_transform** **(** :ref:`Transform<class_transform>` global **)**
  160. Set the transform globally, relative to worldspace.
  161. .. _class_Spatial_set_hidden:
  162. - void **set_hidden** **(** :ref:`bool<class_bool>` hidden **)**
  163. .. _class_Spatial_set_identity:
  164. - void **set_identity** **(** **)**
  165. .. _class_Spatial_set_ignore_transform_notification:
  166. - void **set_ignore_transform_notification** **(** :ref:`bool<class_bool>` enabled **)**
  167. .. _class_Spatial_set_notify_local_transform:
  168. - void **set_notify_local_transform** **(** :ref:`bool<class_bool>` enable **)**
  169. .. _class_Spatial_set_rotation:
  170. - void **set_rotation** **(** :ref:`Vector3<class_vector3>` rotation_rad **)**
  171. .. _class_Spatial_set_rotation_deg:
  172. - void **set_rotation_deg** **(** :ref:`Vector3<class_vector3>` rotation_deg **)**
  173. .. _class_Spatial_set_scale:
  174. - void **set_scale** **(** :ref:`Vector3<class_vector3>` scale **)**
  175. .. _class_Spatial_set_transform:
  176. - void **set_transform** **(** :ref:`Transform<class_transform>` local **)**
  177. Set the transform locally, relative to the parent spatial node.
  178. .. _class_Spatial_set_translation:
  179. - void **set_translation** **(** :ref:`Vector3<class_vector3>` translation **)**
  180. .. _class_Spatial_show:
  181. - void **show** **(** **)**
  182. .. _class_Spatial_translate:
  183. - void **translate** **(** :ref:`Vector3<class_vector3>` offset **)**
  184. .. _class_Spatial_update_gizmo:
  185. - void **update_gizmo** **(** **)**