Most basic 3D game object, parent of all 3D-related nodes.
    public class Spatial : Node

Most basic 3D game object, with a 3D 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.

Affine operations (rotate, scale, translate) happen in parent’s local coordinate system, unless the Spatial object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the Spatial’s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the Spatial object itself is referred to as object-local coordinate system.

Inheritance Chain

Derived Classes

Static Fields

    public const Int32 NotificationEnterWorld = 41

    public const Int32 NotificationExitWorld = 42

    public const Int32 NotificationTransformChanged = 2000

    public const Int32 NotificationVisibilityChanged = 43

Constructors

    public Spatial()

Signals

    "visibility_changed" ()

Emitted when node visibility changes.

Properties

    public SpatialGizmo Gizmo { get; set; }

The SpatialGizmo for this node. Used for example in EditorSpatialGizmo as custom visualization and editing handles in Editor.

    public Transform GlobalTransform { get; set; }

World space (global) Transform of this node.

    public Vector3 Rotation { get; set; }

Rotation part of the local transformation in radians, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle).

Note: 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.

    public Vector3 RotationDegrees { get; set; }

Rotation part of the local transformation in degrees, specified in terms of YXZ-Euler angles in the format (X angle, Y angle, Z angle).

    public Vector3 Scale { get; set; }

Scale part of the local transformation.

    public Transform Transform { get; set; }

Local space Transform of this node, with respect to the parent node.

    public Vector3 Translation { get; set; }

Local translation of this node.

    public bool Visible { get; set; }

If true, this node is drawn.

Methods

    public void ForceUpdateTransform()

    [Obsolete("GetGizmo is deprecated. Use the Gizmo property instead.")]
    public SpatialGizmo GetGizmo()

Getter for Gizmo

    [Obsolete("GetGlobalTransform is deprecated. Use the GlobalTransform property instead.")]
    public Transform GetGlobalTransform()

Getter for GlobalTransform

    public Spatial GetParentSpatial()

Returns the parent Spatial, or an empty Object if no parent exists or parent is not of type Spatial.

    [Obsolete("GetRotation is deprecated. Use the Rotation property instead.")]
    public Vector3 GetRotation()

Getter for Rotation

    [Obsolete("GetRotationDegrees is deprecated. Use the RotationDegrees property instead.")]
    public Vector3 GetRotationDegrees()

Getter for RotationDegrees

    [Obsolete("GetScale is deprecated. Use the Scale property instead.")]
    public Vector3 GetScale()

Getter for Scale

    [Obsolete("GetTransform is deprecated. Use the Transform property instead.")]
    public Transform GetTransform()

Getter for Transform

    [Obsolete("GetTranslation is deprecated. Use the Translation property instead.")]
    public Vector3 GetTranslation()

Getter for Translation

    public World GetWorld()

Returns the current World resource this Spatial node is registered to.

    public void GlobalRotate(Vector3 axis, float angle)

Rotates the global (world) transformation around axis, a unit Vector3, by specified angle in radians. The rotation axis is in global coordinate system.

    public void GlobalScale(Vector3 scale)

    public void GlobalTranslate(Vector3 offset)

Moves the global (world) transformation by Vector3 offset. The offset is in global coordinate system.

    public void Hide()

Disables rendering of this node. Changes Visible to false.

    public bool IsLocalTransformNotificationEnabled()

Returns whether node notifies about its local transformation changes. Spatial will not propagate this by default.

    public bool IsScaleDisabled()

    public bool IsSetAsToplevel()

Returns whether this node is set as Toplevel, that is whether it ignores its parent nodes transformations.

    public bool IsTransformNotificationEnabled()

Returns whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default.

    [Obsolete("IsVisible is deprecated. Use the Visible property instead.")]
    public bool IsVisible()

Getter for Visible

    public bool IsVisibleInTree()

Returns whether the node is visible, taking into consideration that its parents visibility.

    public void LookAt(Vector3 target, Vector3 up)

Rotates itself so that the local -Z axis points towards the target position.

The transform will first be rotated around the given up vector, and then fully aligned to the target by a further rotation around an axis perpendicular to both the target and up vectors.

Operations take place in global space.

    public void LookAtFromPosition(Vector3 position, Vector3 target, Vector3 up)

Moves the node to the specified position, and then rotates itself to point toward the target as per LookAt(Godot.Vector3, Godot.Vector3). Operations take place in global space.

    public void Orthonormalize()

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.

    public void Rotate(Vector3 axis, float angle)

Rotates the local transformation around axis, a unit Vector3, by specified angle in radians.

    public void RotateObjectLocal(Vector3 axis, float angle)

Rotates the local transformation around axis, a unit Vector3, by specified angle in radians. The rotation axis is in object-local coordinate system.

    public void RotateX(float angle)

Rotates the local transformation around the X axis by angle in radians.

    public void RotateY(float angle)

Rotates the local transformation around the Y axis by angle in radians.

    public void RotateZ(float angle)

Rotates the local transformation around the Z axis by angle in radians.

    public void ScaleObjectLocal(Vector3 scale)

Scales the local transformation by given 3D scale factors in object-local coordinate system.

    public void SetAsToplevel(bool enable)

Makes the node ignore its parents transformations. Node transformations are only in global space.

    public void SetDisableScale(bool disable)

    [Obsolete("SetGizmo is deprecated. Use the Gizmo property instead.")]
    public void SetGizmo(SpatialGizmo gizmo)

Setter for Gizmo

    [Obsolete("SetGlobalTransform is deprecated. Use the GlobalTransform property instead.")]
    public void SetGlobalTransform(Transform global)

Setter for GlobalTransform

    public void SetIdentity()

Reset all transformations for this node (sets its Transform to the identity matrix).

    public void SetIgnoreTransformNotification(bool enabled)

Sets whether the node ignores notification that its transformation (global or local) changed.

    public void SetNotifyLocalTransform(bool enable)

Sets whether the node notifies about its local transformation changes. Spatial will not propagate this by default.

    public void SetNotifyTransform(bool enable)

Sets whether the node notifies about its global and local transformation changes. Spatial will not propagate this by default.

    [Obsolete("SetRotation is deprecated. Use the Rotation property instead.")]
    public void SetRotation(Vector3 euler)

Setter for Rotation

    [Obsolete("SetRotationDegrees is deprecated. Use the RotationDegrees property instead.")]
    public void SetRotationDegrees(Vector3 eulerDegrees)

Setter for RotationDegrees

    [Obsolete("SetScale is deprecated. Use the Scale property instead.")]
    public void SetScale(Vector3 scale)

Setter for Scale

    [Obsolete("SetTransform is deprecated. Use the Transform property instead.")]
    public void SetTransform(Transform local)

Setter for Transform

    [Obsolete("SetTranslation is deprecated. Use the Translation property instead.")]
    public void SetTranslation(Vector3 translation)

Setter for Translation

    [Obsolete("SetVisible is deprecated. Use the Visible property instead.")]
    public void SetVisible(bool visible)

Setter for Visible

    public void Show()

Enables rendering of this node. Changes Visible to true.

    public Vector3 ToGlobal(Vector3 localPoint)

Transforms localPoint from this node’s local space to world space.

    public Vector3 ToLocal(Vector3 globalPoint)

Transforms globalPoint from world space to this node’s local space.

    public void Translate(Vector3 offset)

Changes the node’s position by given offset Vector3.

Note that the translation offset is affected by the node’s scale, so if scaled by e.g. (10, 1, 1), a translation by an offset of (2, 0, 0) would actually add 20 (2 * 10) to the X coordinate.

    public void TranslateObjectLocal(Vector3 offset)

    public void UpdateGizmo()

Updates the SpatialGizmo of this node.

Tags: