Documentation
¶
Overview ¶
Package Node3D provides methods for working with Node3D object instances.
Index ¶
- type Advanced
- type Any
- type EulerOrder
- type Instance
- func (self Instance) AddGizmo(gizmo [1]gdclass.Node3DGizmo)
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode3D() Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) Basis() Basis.XYZ
- func (self Instance) ClearGizmos()
- func (self Instance) ClearSubgizmoSelection()
- func (self Instance) ForceUpdateTransform()
- func (self Instance) GetGizmos() [][1]gdclass.Node3DGizmo
- func (self Instance) GetParentNode3d() [1]gdclass.Node3D
- func (self Instance) GetWorld3d() [1]gdclass.World3D
- func (self Instance) GlobalBasis() Basis.XYZ
- func (self Instance) GlobalPosition() Vector3.XYZ
- func (self Instance) GlobalRotate(axis Vector3.XYZ, angle Float.X)
- func (self Instance) GlobalRotation() Vector3.XYZ
- func (self Instance) GlobalRotationDegrees() Vector3.XYZ
- func (self Instance) GlobalScale(scale Vector3.XYZ)
- func (self Instance) GlobalTransform() Transform3D.BasisOrigin
- func (self Instance) GlobalTranslate(offset Vector3.XYZ)
- func (self Instance) Hide()
- func (self Instance) IsLocalTransformNotificationEnabled() bool
- func (self Instance) IsScaleDisabled() bool
- func (self Instance) IsTransformNotificationEnabled() bool
- func (self Instance) IsVisibleInTree() bool
- func (self Instance) LookAt(target Vector3.XYZ)
- func (self Instance) LookAtFromPosition(position Vector3.XYZ, target Vector3.XYZ)
- func (self Instance) OnVisibilityChanged(cb func())
- func (self Instance) Orthonormalize()
- func (self Instance) Position() Vector3.XYZ
- func (self Instance) Quaternion() Quaternion.IJKX
- func (self Instance) Rotate(axis Vector3.XYZ, angle Float.X)
- func (self Instance) RotateObjectLocal(axis Vector3.XYZ, angle Float.X)
- func (self Instance) RotateX(angle Float.X)
- func (self Instance) RotateY(angle Float.X)
- func (self Instance) RotateZ(angle Float.X)
- func (self Instance) Rotation() Vector3.XYZ
- func (self Instance) RotationDegrees() Vector3.XYZ
- func (self Instance) RotationEditMode() gdclass.Node3DRotationEditMode
- func (self Instance) RotationOrder() EulerOrder
- func (self Instance) Scale() Vector3.XYZ
- func (self Instance) ScaleObjectLocal(scale Vector3.XYZ)
- func (self Instance) SetBasis(value Basis.XYZ)
- func (self Instance) SetDisableScale(disable bool)
- func (self Instance) SetGlobalBasis(value Basis.XYZ)
- func (self Instance) SetGlobalPosition(value Vector3.XYZ)
- func (self Instance) SetGlobalRotation(value Vector3.XYZ)
- func (self Instance) SetGlobalRotationDegrees(value Vector3.XYZ)
- func (self Instance) SetGlobalTransform(value Transform3D.BasisOrigin)
- func (self Instance) SetIdentity()
- func (self Instance) SetIgnoreTransformNotification(enabled bool)
- func (self Instance) SetNotifyLocalTransform(enable bool)
- func (self Instance) SetNotifyTransform(enable bool)
- func (self Instance) SetPosition(value Vector3.XYZ)
- func (self Instance) SetQuaternion(value Quaternion.IJKX)
- func (self Instance) SetRotation(value Vector3.XYZ)
- func (self Instance) SetRotationDegrees(value Vector3.XYZ)
- func (self Instance) SetRotationEditMode(value gdclass.Node3DRotationEditMode)
- func (self Instance) SetRotationOrder(value EulerOrder)
- func (self Instance) SetScale(value Vector3.XYZ)
- func (self Instance) SetSubgizmoSelection(gizmo [1]gdclass.Node3DGizmo, id int, transform Transform3D.BasisOrigin)
- func (self Instance) SetTopLevel(value bool)
- func (self Instance) SetTransform(value Transform3D.BasisOrigin)
- func (self Instance) SetVisibilityParent(value string)
- func (self Instance) SetVisible(value bool)
- func (self Instance) Show()
- func (self Instance) ToGlobal(local_point Vector3.XYZ) Vector3.XYZ
- func (self Instance) ToLocal(global_point Vector3.XYZ) Vector3.XYZ
- func (self Instance) TopLevel() bool
- func (self Instance) Transform() Transform3D.BasisOrigin
- func (self Instance) Translate(offset Vector3.XYZ)
- func (self Instance) TranslateObjectLocal(offset Vector3.XYZ)
- func (self *Instance) UnsafePointer() unsafe.Pointer
- func (self Instance) UpdateGizmos()
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VisibilityParent() string
- func (self Instance) Visible() bool
- type RotationEditMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type EulerOrder ¶
type EulerOrder int
const ( /*Specifies that Euler angles should be in XYZ order. When composing, the order is X, Y, Z. When decomposing, the order is reversed, first Z, then Y, and X last.*/ EulerOrderXyz EulerOrder = 0 /*Specifies that Euler angles should be in XZY order. When composing, the order is X, Z, Y. When decomposing, the order is reversed, first Y, then Z, and X last.*/ EulerOrderXzy EulerOrder = 1 /*Specifies that Euler angles should be in YXZ order. When composing, the order is Y, X, Z. When decomposing, the order is reversed, first Z, then X, and Y last.*/ EulerOrderYxz EulerOrder = 2 /*Specifies that Euler angles should be in YZX order. When composing, the order is Y, Z, X. When decomposing, the order is reversed, first X, then Z, and Y last.*/ EulerOrderYzx EulerOrder = 3 /*Specifies that Euler angles should be in ZXY order. When composing, the order is Z, X, Y. When decomposing, the order is reversed, first Y, then X, and Z last.*/ EulerOrderZxy EulerOrder = 4 /*Specifies that Euler angles should be in ZYX order. When composing, the order is Z, Y, X. When decomposing, the order is reversed, first X, then Y, and Z last.*/ EulerOrderZyx EulerOrder = 5 )
type Instance ¶
Most basic 3D game object, with a [Transform3D] and visibility settings. All other 3D game objects inherit from [Node3D]. Use [Node3D] 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 [Node3D] object is set as top-level. Affine operations in this coordinate system correspond to direct affine operations on the [Node3D]'s transform. The word local below refers to this coordinate system. The coordinate system that is attached to the [Node3D] object itself is referred to as object-local coordinate system. [b]Note:[/b] Unless otherwise specified, all methods that have angle parameters must have angles specified as [i]radians[/i]. To convert degrees to radians, use [method @GlobalScope.deg_to_rad]. [b]Note:[/b] Be aware that "Spatial" nodes are now called "Node3D" starting with Godot 4. Any Godot 3.x references to "Spatial" nodes refer to "Node3D" in Godot 4.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AddGizmo ¶
func (self Instance) AddGizmo(gizmo [1]gdclass.Node3DGizmo)
Attach an editor gizmo to this [Node3D]. [b]Note:[/b] The gizmo object would typically be an instance of [EditorNode3DGizmo], but the argument type is kept generic to avoid creating a dependency on editor classes in [Node3D].
func (Instance) ClearGizmos ¶
func (self Instance) ClearGizmos()
Clear all gizmos attached to this [Node3D].
func (Instance) ClearSubgizmoSelection ¶
func (self Instance) ClearSubgizmoSelection()
Clears subgizmo selection for this node in the editor. Useful when subgizmo IDs become invalid after a property change.
func (Instance) ForceUpdateTransform ¶
func (self Instance) ForceUpdateTransform()
Forces the transform to update. Transform changes in physics are not instant for performance reasons. Transforms are accumulated and then set. Use this if you need an up-to-date transform when doing physics operations.
func (Instance) GetGizmos ¶
func (self Instance) GetGizmos() [][1]gdclass.Node3DGizmo
Returns all the gizmos attached to this [Node3D].
func (Instance) GetParentNode3d ¶
Returns the parent [Node3D], or [code]null[/code] if no parent exists, the parent is not of type [Node3D], or [member top_level] is [code]true[/code]. [b]Note:[/b] Calling this method is not equivalent to [code]get_parent() as Node3D[/code], which does not take [member top_level] into account.
func (Instance) GetWorld3d ¶
Returns the current [World3D] resource this [Node3D] node is registered to.
func (Instance) GlobalBasis ¶
func (Instance) GlobalPosition ¶
func (Instance) GlobalRotate ¶
Rotates the global (world) transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in global coordinate system.
func (Instance) GlobalRotation ¶
func (Instance) GlobalRotationDegrees ¶
func (Instance) GlobalScale ¶
Scales the global (world) transformation by the given [Vector3] scale factors.
func (Instance) GlobalTransform ¶
func (self Instance) GlobalTransform() Transform3D.BasisOrigin
func (Instance) GlobalTranslate ¶
Moves the global (world) transformation by [Vector3] offset. The offset is in global coordinate system.
func (Instance) Hide ¶
func (self Instance) Hide()
Disables rendering of this node. Changes [member visible] to [code]false[/code].
func (Instance) IsLocalTransformNotificationEnabled ¶
Returns whether node notifies about its local transformation changes. [Node3D] will not propagate this by default.
func (Instance) IsScaleDisabled ¶
Returns whether this node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale.
func (Instance) IsTransformNotificationEnabled ¶
Returns whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default.
func (Instance) IsVisibleInTree ¶
Returns [code]true[/code] if the node is present in the [SceneTree], its [member visible] property is [code]true[/code] and all its ancestors are also visible. If any ancestor is hidden, this node will not be visible in the scene tree.
func (Instance) LookAt ¶
Rotates the node so that the local forward axis (-Z, [constant Vector3.FORWARD]) points toward the [param target] position. The local up axis (+Y) points as close to the [param up] vector as possible while staying perpendicular to the local forward axis. The resulting transform is orthogonal, and the scale is preserved. Non-uniform scaling may not work correctly. The [param target] position cannot be the same as the node's position, the [param up] vector cannot be zero, and the direction from the node's position to the [param target] vector cannot be parallel to the [param up] vector. Operations take place in global space, which means that the node must be in the scene tree. If [param use_model_front] is [code]true[/code], the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the [param target] position. By default, the -Z axis (camera forward) is treated as forward (implies +X is right).
func (Instance) LookAtFromPosition ¶
Moves the node to the specified [param position], and then rotates the node to point toward the [param target] as per [method look_at]. Operations take place in global space.
func (Instance) OnVisibilityChanged ¶
func (self Instance) OnVisibilityChanged(cb func())
func (Instance) Orthonormalize ¶
func (self Instance) 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].
func (Instance) Quaternion ¶
func (self Instance) Quaternion() Quaternion.IJKX
func (Instance) Rotate ¶
Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians.
func (Instance) RotateObjectLocal ¶
Rotates the local transformation around axis, a unit [Vector3], by specified angle in radians. The rotation axis is in object-local coordinate system.
func (Instance) RotationDegrees ¶
func (Instance) RotationEditMode ¶
func (self Instance) RotationEditMode() gdclass.Node3DRotationEditMode
func (Instance) RotationOrder ¶
func (self Instance) RotationOrder() EulerOrder
func (Instance) ScaleObjectLocal ¶
Scales the local transformation by given 3D scale factors in object-local coordinate system.
func (Instance) SetDisableScale ¶
Sets whether the node uses a scale of [code](1, 1, 1)[/code] or its local transformation scale. Changes to the local transformation scale are preserved.
func (Instance) SetGlobalBasis ¶
func (Instance) SetGlobalPosition ¶
func (Instance) SetGlobalRotation ¶
func (Instance) SetGlobalRotationDegrees ¶
func (Instance) SetGlobalTransform ¶
func (self Instance) SetGlobalTransform(value Transform3D.BasisOrigin)
func (Instance) SetIdentity ¶
func (self Instance) SetIdentity()
Reset all transformations for this node (sets its [Transform3D] to the identity matrix).
func (Instance) SetIgnoreTransformNotification ¶
Sets whether the node ignores notification that its transformation (global or local) changed.
func (Instance) SetNotifyLocalTransform ¶
Sets whether the node notifies about its local transformation changes. [Node3D] will not propagate this by default.
func (Instance) SetNotifyTransform ¶
Sets whether the node notifies about its global and local transformation changes. [Node3D] will not propagate this by default, unless it is in the editor context and it has a valid gizmo.
func (Instance) SetPosition ¶
func (Instance) SetQuaternion ¶
func (self Instance) SetQuaternion(value Quaternion.IJKX)
func (Instance) SetRotation ¶
func (Instance) SetRotationDegrees ¶
func (Instance) SetRotationEditMode ¶
func (self Instance) SetRotationEditMode(value gdclass.Node3DRotationEditMode)
func (Instance) SetRotationOrder ¶
func (self Instance) SetRotationOrder(value EulerOrder)
func (Instance) SetSubgizmoSelection ¶
func (self Instance) SetSubgizmoSelection(gizmo [1]gdclass.Node3DGizmo, id int, transform Transform3D.BasisOrigin)
Set subgizmo selection for this node in the editor. [b]Note:[/b] The gizmo object would typically be an instance of [EditorNode3DGizmo], but the argument type is kept generic to avoid creating a dependency on editor classes in [Node3D].
func (Instance) SetTopLevel ¶
func (Instance) SetTransform ¶
func (self Instance) SetTransform(value Transform3D.BasisOrigin)
func (Instance) SetVisibilityParent ¶
func (Instance) SetVisible ¶
func (Instance) Show ¶
func (self Instance) Show()
Enables rendering of this node. Changes [member visible] to [code]true[/code].
func (Instance) ToGlobal ¶
Transforms [param local_point] from this node's local space to world space.
func (Instance) ToLocal ¶
Transforms [param global_point] from world space to this node's local space.
func (Instance) Transform ¶
func (self Instance) Transform() Transform3D.BasisOrigin
func (Instance) Translate ¶
Changes the node's position by the given offset [Vector3]. Note that the translation [param offset] is affected by the node's scale, so if scaled by e.g. [code](10, 1, 1)[/code], a translation by an offset of [code](2, 0, 0)[/code] would actually add 20 ([code]2 * 10[/code]) to the X coordinate.
func (Instance) TranslateObjectLocal ¶
Changes the node's position by the given offset [Vector3] in local space.
func (*Instance) UnsafePointer ¶
func (Instance) UpdateGizmos ¶
func (self Instance) UpdateGizmos()
Updates all the [Node3D] gizmos attached to this node.
func (Instance) VisibilityParent ¶
type RotationEditMode ¶
type RotationEditMode = gdclass.Node3DRotationEditMode //gd:Node3D.RotationEditMode
const ( /*The rotation is edited using [Vector3] Euler angles.*/ RotationEditModeEuler RotationEditMode = 0 /*The rotation is edited using a [Quaternion].*/ RotationEditModeQuaternion RotationEditMode = 1 /*The rotation is edited using a [Basis]. In this mode, [member scale] can't be edited separately.*/ RotationEditModeBasis RotationEditMode = 2 )