.. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Spatial.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Spatial: Spatial ======= **Inherits:** :ref:`Node` **<** :ref:`Object` **Inherited By:** :ref:`Joint`, :ref:`RayCast`, :ref:`Camera`, :ref:`BoneAttachment`, :ref:`CollisionShape`, :ref:`AudioStreamPlayer3D`, :ref:`Path`, :ref:`ARVRController`, :ref:`VisualInstance`, :ref:`VehicleWheel`, :ref:`Position3D`, :ref:`ProximityGroup`, :ref:`ARVRAnchor`, :ref:`RemoteTransform`, :ref:`CollisionObject`, :ref:`PathFollow`, :ref:`NavigationMeshInstance`, :ref:`Listener`, :ref:`VisibilityNotifier`, :ref:`Navigation`, :ref:`CollisionPolygon`, :ref:`GridMap`, :ref:`Skeleton`, :ref:`ARVROrigin` **Category:** Core Brief Description ----------------- Most basic 3D game object, parent of all 3D related nodes. Member Functions ---------------- +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`SpatialGizmo` | :ref:`get_gizmo` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`get_global_transform` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Spatial` | :ref:`get_parent_spatial` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`get_rotation` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`get_rotation_deg` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`get_scale` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`get_transform` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`get_translation` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`World` | :ref:`get_world` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`global_rotate` **(** :ref:`Vector3` normal, :ref:`float` radians **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`global_translate` **(** :ref:`Vector3` offset **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`hide` **(** **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_local_transform_notification_enabled` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_set_as_toplevel` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_transform_notification_enabled` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_visible` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_visible_in_tree` **(** **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`look_at` **(** :ref:`Vector3` target, :ref:`Vector3` up **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`look_at_from_position` **(** :ref:`Vector3` position, :ref:`Vector3` target, :ref:`Vector3` up **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`orthonormalize` **(** **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rotate` **(** :ref:`Vector3` normal, :ref:`float` radians **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rotate_x` **(** :ref:`float` radians **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rotate_y` **(** :ref:`float` radians **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`rotate_z` **(** :ref:`float` radians **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_as_toplevel` **(** :ref:`bool` enable **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_gizmo` **(** :ref:`SpatialGizmo` gizmo **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_global_transform` **(** :ref:`Transform` global **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_identity` **(** **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_ignore_transform_notification` **(** :ref:`bool` enabled **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_notify_local_transform` **(** :ref:`bool` enable **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_notify_transform` **(** :ref:`bool` enable **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_rotation` **(** :ref:`Vector3` rotation_rad **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_rotation_deg` **(** :ref:`Vector3` rotation_deg **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_scale` **(** :ref:`Vector3` scale **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_transform` **(** :ref:`Transform` local **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_translation` **(** :ref:`Vector3` translation **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_visible` **(** :ref:`bool` visible **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`show` **(** **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`to_global` **(** :ref:`Vector3` local_point **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Vector3` | :ref:`to_local` **(** :ref:`Vector3` global_point **)** const | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`translate` **(** :ref:`Vector3` offset **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`update_gizmo` **(** **)** | +------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Signals ------- - **visibility_changed** **(** **)** Emitted when node visibility changes. Member Variables ---------------- - :ref:`Transform` **global_transform** - World space (global) [Transform] of this node. - :ref:`Vector3` **rotation** - Local euler rotation in radians of this node. - :ref:`Vector3` **rotation_deg** - Local euler rotation in degrees of this node. - :ref:`Vector3` **scale** - Local scale of this node. - :ref:`Transform` **transform** - Local space [Transform] of this node. - :ref:`Vector3` **translation** - Local translation of this node. - :ref:`bool` **visible** - Visibility of this node. Toggles if this node is rendered. Numeric Constants ----------------- - **NOTIFICATION_TRANSFORM_CHANGED** = **29** --- Spatial nodes receives this notification when their global transform changes. This means that either the current or a parent node changed its transform. In order for NOTIFICATION_TRANSFORM_CHANGED to work user first needs to ask for it, with set_notify_transform(true). - **NOTIFICATION_ENTER_WORLD** = **41** --- Spatial nodes receives this notification when they are registered to new :ref:`World` resource. - **NOTIFICATION_EXIT_WORLD** = **42** --- Spatial nodes receives this notification when they are unregistered from current :ref:`World` resource. - **NOTIFICATION_VISIBILITY_CHANGED** = **43** --- Spatial nodes receives this notification when their visibility changes. Description ----------- Most basic 3D game object, with a 3D :ref:`Transform` and visibility settings. All other 3D game objects inherit from Spatial. Use Spatial as a parent node to move, scale, rotate and show/hide children in a 3D project. Member Function Description --------------------------- .. _class_Spatial_get_gizmo: - :ref:`SpatialGizmo` **get_gizmo** **(** **)** const Returns the SpatialGizmo for this node. Used for example in :ref:`EditorSpatialGizmo` as custom visualization and editing handles in Editor. .. _class_Spatial_get_global_transform: - :ref:`Transform` **get_global_transform** **(** **)** const Returns the global transform, relative to worldspace. .. _class_Spatial_get_parent_spatial: - :ref:`Spatial` **get_parent_spatial** **(** **)** const Returns the parent :ref:`Spatial`, or an empty :ref:`Object` if no parent exists or parent is not of type :ref:`Spatial`. .. _class_Spatial_get_rotation: - :ref:`Vector3` **get_rotation** **(** **)** const Returns the rotation (in radians). .. _class_Spatial_get_rotation_deg: - :ref:`Vector3` **get_rotation_deg** **(** **)** const Returns the rotation (in degrees). .. _class_Spatial_get_scale: - :ref:`Vector3` **get_scale** **(** **)** const .. _class_Spatial_get_transform: - :ref:`Transform` **get_transform** **(** **)** const Returns the local transform, relative to the bone parent. .. _class_Spatial_get_translation: - :ref:`Vector3` **get_translation** **(** **)** const .. _class_Spatial_get_world: - :ref:`World` **get_world** **(** **)** const Returns the current :ref:`World` resource this Spatial node is registered to. .. _class_Spatial_global_rotate: - void **global_rotate** **(** :ref:`Vector3` normal, :ref:`float` radians **)** Rotates the current node along normal :ref:`Vector3` by angle in radians in Global space. .. _class_Spatial_global_translate: - void **global_translate** **(** :ref:`Vector3` offset **)** Moves the node by :ref:`Vector3` offset in Global space. .. _class_Spatial_hide: - void **hide** **(** **)** Disables rendering of this node. Change Spatial Visible property to false. .. _class_Spatial_is_local_transform_notification_enabled: - :ref:`bool` **is_local_transform_notification_enabled** **(** **)** const Returns whether node notifies about its local transformation changes. Spatial will not propagate this by default. .. _class_Spatial_is_set_as_toplevel: - :ref:`bool` **is_set_as_toplevel** **(** **)** const Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations. .. _class_Spatial_is_transform_notification_enabled: - :ref:`bool` **is_transform_notification_enabled** **(** **)** const Returns whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default. .. _class_Spatial_is_visible: - :ref:`bool` **is_visible** **(** **)** const Returns whether the node is set to be visible. .. _class_Spatial_is_visible_in_tree: - :ref:`bool` **is_visible_in_tree** **(** **)** const Returns whether the node is visible, taking into consideration that its parents visibility. .. _class_Spatial_look_at: - void **look_at** **(** :ref:`Vector3` target, :ref:`Vector3` up **)** Rotates itself to point into direction of target position. Operations take place in global space. .. _class_Spatial_look_at_from_position: - void **look_at_from_position** **(** :ref:`Vector3` position, :ref:`Vector3` target, :ref:`Vector3` up **)** Moves the node to specified position and then rotates itself to point into direction of target position. Operations take place in global space. .. _class_Spatial_orthonormalize: - void **orthonormalize** **(** **)** Resets this node's transformations (like scale, skew and taper) preserving its rotation and translation. Performs orthonormalization on this node Transform3D. .. _class_Spatial_rotate: - void **rotate** **(** :ref:`Vector3` normal, :ref:`float` radians **)** Rotates the node in local space on given normal :ref:`Vector3` by angle in radians. .. _class_Spatial_rotate_x: - void **rotate_x** **(** :ref:`float` radians **)** Rotates the node in local space on X axis by angle in radians. .. _class_Spatial_rotate_y: - void **rotate_y** **(** :ref:`float` radians **)** Rotates the node in local space on Y axis by angle in radians. .. _class_Spatial_rotate_z: - void **rotate_z** **(** :ref:`float` radians **)** Rotates the node in local space on Z axis by angle in radians. .. _class_Spatial_set_as_toplevel: - void **set_as_toplevel** **(** :ref:`bool` enable **)** Makes the node ignore its parents tranformations. Node tranformations are only in global space. .. _class_Spatial_set_gizmo: - void **set_gizmo** **(** :ref:`SpatialGizmo` gizmo **)** Set :ref:`SpatialGizmo` for this node. Used for example in :ref:`EditorSpatialGizmo` as custom visualization and editing handles in Editor. .. _class_Spatial_set_global_transform: - void **set_global_transform** **(** :ref:`Transform` global **)** Set the transform globally, relative to world space. .. _class_Spatial_set_identity: - void **set_identity** **(** **)** Reset all tranformations for this node. Set its Transform3D to identity matrix. .. _class_Spatial_set_ignore_transform_notification: - void **set_ignore_transform_notification** **(** :ref:`bool` enabled **)** Set whether the node ignores notification that its transformation (global or local) changed. .. _class_Spatial_set_notify_local_transform: - void **set_notify_local_transform** **(** :ref:`bool` enable **)** Set whether the node notifies about its local transformation changes. Spatial will not propagate this by default. .. _class_Spatial_set_notify_transform: - void **set_notify_transform** **(** :ref:`bool` enable **)** Set whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default. .. _class_Spatial_set_rotation: - void **set_rotation** **(** :ref:`Vector3` rotation_rad **)** Set the rotation (in radians). .. _class_Spatial_set_rotation_deg: - void **set_rotation_deg** **(** :ref:`Vector3` rotation_deg **)** Set the rotation (in degrees). .. _class_Spatial_set_scale: - void **set_scale** **(** :ref:`Vector3` scale **)** Set the scale. .. _class_Spatial_set_transform: - void **set_transform** **(** :ref:`Transform` local **)** Set the transform locally, relative to the parent spatial node. .. _class_Spatial_set_translation: - void **set_translation** **(** :ref:`Vector3` translation **)** .. _class_Spatial_set_visible: - void **set_visible** **(** :ref:`bool` visible **)** .. _class_Spatial_show: - void **show** **(** **)** Enables rendering of this node. Change Spatial Visible property to "True". .. _class_Spatial_to_global: - :ref:`Vector3` **to_global** **(** :ref:`Vector3` local_point **)** const Tranforms :ref:`Vector3` "local_point" from this node's local space to world space. .. _class_Spatial_to_local: - :ref:`Vector3` **to_local** **(** :ref:`Vector3` global_point **)** const Tranforms :ref:`Vector3` "global_point" from world space to this node's local space. .. _class_Spatial_translate: - void **translate** **(** :ref:`Vector3` offset **)** Changes the node's position by given offset :ref:`Vector3`. .. _class_Spatial_update_gizmo: - void **update_gizmo** **(** **)** Updates the :ref:`SpatialGizmo` of this node.