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 = 29

    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, specified in terms of YXZ-Euler angles in the format (X-angle, Y-angle, Z-angle), in radians.

Note that in the mathematical sense, rotation is a matrix and not a vector. The three Euler angles, which are the three indepdent 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, specified in terms of YXZ-Euler angles in the format (X-angle, Y-angle, Z-angle), in degrees.

    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; }

Visibility of this node. Toggles if this node is rendered.

Methods

    public SpatialGizmo GetGizmo()

Getter for Gizmo

    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.

    public Vector3 GetRotation()

Getter for Rotation

    public Vector3 GetRotationDegrees()

Getter for RotationDegrees

    public Vector3 GetScale()

Getter for Scale

    public Transform GetTransform()

Getter for Transform

    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. Change Spatial Visible property to false.

    public bool IsLocalTransformNotificationEnabled()

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

    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.

    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 to point into direction of target position. Operations take place in global space.

    public void LookAtFromPosition(Vector3 position, Vector3 target, 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.

    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 Transform3D.

    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 SetGizmo(SpatialGizmo gizmo)

Setter for Gizmo

    public void SetGlobalTransform(Transform global)

Setter for GlobalTransform

    public void SetIdentity()

Reset all transformations for this node. Set its Transform3D to identity matrix.

    public void SetIgnoreTransformNotification(bool enabled)

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

    public void SetNotifyLocalTransform(bool enable)

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

    public void SetNotifyTransform(bool enable)

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

    public void SetRotation(Vector3 euler)

Setter for Rotation

    public void SetRotationDegrees(Vector3 eulerDegrees)

Setter for RotationDegrees

    public void SetScale(Vector3 scale)

Setter for Scale

    public void SetTransform(Transform local)

Setter for Transform

    public void SetTranslation(Vector3 translation)

Setter for Translation

    public void SetVisible(bool visible)

Setter for Visible

    public void Show()

Enables rendering of this node. Change Spatial Visible property to “True”.

    public Vector3 ToGlobal(Vector3 localPoint)

Transforms Vector3 “local_point” from this node’s local space to world space.

    public Vector3 ToLocal(Vector3 globalPoint)

Transforms Vector3 “global_point” from world space to this node’s local space.

    public void Translate(Vector3 offset)

Changes the node’s position by given offset Vector3.

    public void TranslateObjectLocal(Vector3 offset)

    public void UpdateGizmo()

Updates the SpatialGizmo of this node.

Tags: