class-description NEWS COMMUNITY STORE TUTORIALS SIGN UP LOGIN LOGOUT ROKOJORI NEWSLETTER SIGN UP LOGIN LOGOUT NEWS COMMUNITY STORE TUTORIALS TOGGLE FULLSCREEN VOLLBILD AN/AUS ObjectNode Node3D
Base object in 3D space, inherited by all 3D nodes.
The Node3D node is the base representation of a node in 3D space. All other 3D nodes inherit from this class.
Affine operations (translation, rotation, scale) are calculated in the coordinate system relative to the parent, unless the Node3D's top_level is true. In this coordinate system, affine operations correspond to direct affine operations on the Node3D's transform. The term parent space refers to this coordinate system. The coordinate system that is attached to the Node3D itself is referred to as object-local coordinate system, or local space.
Note: Unless otherwise specified, all methods that need angle parameters must receive angles in radians. To convert degrees to radians, use [method @GlobalScope.deg_to_rad].
Note: In Godot 3 and older, Node3D was named Spatial.
* Constants<>():*

NOTIFICATION_TRANSFORM_CHANGED:null = 2000
Notification received when this node's global_transform changes, if is_transform_notification_enabled is true. See also set_notify_transform.
Note: Most 3D nodes such as VisualInstance3D or CollisionObject3D automatically enable this to function correctly.
Note: In the editor, nodes will propagate this notification to their children if a gizmo is attached (see add_gizmo).


NOTIFICATION_ENTER_WORLD:null = 41
Notification received when this node is registered to a new World3D (see get_world_3d).


NOTIFICATION_EXIT_WORLD:null = 42
Notification received when this node is unregistered from the current World3D (see get_world_3d).


NOTIFICATION_VISIBILITY_CHANGED:null = 43
Notification received when this node's visibility changes (see visible and is_visible_in_tree).
This notification is received before the related visibility_changed signal.


NOTIFICATION_LOCAL_TRANSFORM_CHANGED:null = 44
Notification received when this node's transform changes, if is_local_transform_notification_enabled is true. This is not received when a parent Node3D's transform changes. See also set_notify_local_transform.
Note: Some 3D nodes such as CSGShape3D or CollisionShape3D automatically enable this to function correctly.
Enum RotationEditMode<>():Enum

ROTATION_EDIT_MODE_EULER:null = 0
The rotation is edited using a Vector3 in [url=https://en.wikipedia.org/wiki/Euler_angles]Euler angles[/url].


ROTATION_EDIT_MODE_QUATERNION:null = 1
The rotation is edited using a Quaternion.


ROTATION_EDIT_MODE_BASIS:null = 2
The rotation is edited using a Basis. In this mode, the raw basis's axes can be freely modified, but the scale property is not available.
Signal visibility_changed<>():Signal
Emitted when this node's visibility changes (see visible and is_visible_in_tree).

This signal is emitted after the related NOTIFICATION_VISIBILITY_CHANGED notification.
set get Basis basis<>():Basis set get
Basis of the transform property. Represents the rotation, scale, and shear of this node in parent space (relative to the parent node).

set get Basis global_basis<>():Basis set get
Basis of the global_transform property. Represents the rotation, scale, and shear of this node in global space (relative to the world).

Note: If the node is not inside the tree, getting this property fails and returns [constant Basis.IDENTITY].
set get Vector3 global_position<>():Vector3 set get
Global position (translation) of this node in global space (relative to the world). This is equivalent to the global_transform's [member Transform3D.origin].

Note: If the node is not inside the tree, getting this property fails and returns [constant Vector3.ZERO].
set get Vector3 global_rotation<>():Vector3 set get
Global rotation of this node as [url=https://en.wikipedia.org/wiki/Euler_angles]Euler angles[/url], in radians and in global space (relative to the world). This value is obtained from global_basis's rotation.

- The [member Vector3.x] is the angle around the global X axis (pitch);
- The [member Vector3.y] is the angle around the global Y axis (yaw);
- The [member Vector3.z] is the angle around the global Z axis (roll).
Note: Unlike rotation, this property always follows the YXZ convention (EULER_ORDER_YXZ).
Note: If the node is not inside the tree, getting this property fails and returns [constant Vector3.ZERO].
set get Vector3 global_rotation_degrees<>():Vector3 set get
The global_rotation of this node, in degrees instead of radians.

Note: If the node is not inside the tree, getting this property fails and returns [constant Vector3.ZERO].
set get Transform3D global_transform<>():Transform3D set get
The transformation of this node, in global space (relative to the world). Contains and represents this node's global_position, global_rotation, and global scale.

Note: If the node is not inside the tree, getting this property fails and returns [constant Transform3D.IDENTITY].
set get Vector3 position<>():Vector3 set get
Position (translation) of this node in parent space (relative to the parent node). This is equivalent to the transform's [member Transform3D.origin].

set get Quaternion quaternion<>():Quaternion set get
Rotation of this node represented as a Quaternion in parent space (relative to the parent node). This value is obtained from basis's rotation.

Note: Quaternions are much more suitable for 3D math but are less intuitive. Setting this property can be useful for interpolation (see [method Quaternion.slerp]).
set get Vector3 rotation<>():Vector3 set get
Rotation of this node as [url=https://en.wikipedia.org/wiki/Euler_angles]Euler angles[/url], in radians and in parent space (relative to the parent node). This value is obtained from basis's rotation.

- The [member Vector3.x] is the angle around the local X axis (pitch);
- The [member Vector3.y] is the angle around the local Y axis (yaw);
- The [member Vector3.z] is the angle around the local Z axis (roll).
The order of each consecutive rotation can be changed with rotation_order (see EulerOrder constants). By default, the YXZ convention is used (EULER_ORDER_YXZ).
Note: This property is edited in degrees in the inspector. If you want to use degrees in a script, use rotation_degrees.
set get Vector3 rotation_degrees<>():Vector3 set get
The rotation of this node, in degrees instead of radians.

Note: This is not the property available in the Inspector dock.
set get int rotation_edit_mode<>():int set get
How this node's rotation and scale are displayed in the Inspector dock.

set get int rotation_order<>():int set get
The axis rotation order of the rotation property. The final orientation is calculated by rotating around the local X, Y, and Z axis in this order.

set get Vector3 scale<>():Vector3 set get
Scale of this node in local space (relative to this node). This value is obtained from basis's scale.

Note: The behavior of some 3D node types is not affected by this property. These include Light3D, Camera3D, AudioStreamPlayer3D, and more.
Warning: The scale's components must either be all positive or all negative, and not exactly 0.0. Otherwise, it won't be possible to obtain the scale from the basis. This may cause the intended scale to be lost when reloaded from disk, and potentially other unstable behavior.
set get bool top_level<>():bool set get
If true, the node does not inherit its transformations from its parent. As such, node transformations will only be in global space, which also means that global_transform and transform will be identical.

set get Transform3D transform<>():Transform3D set get
The local transformation of this node, in parent space (relative to the parent node). Contains and represents this node's position, rotation, and scale.

set get NodePath visibility_parent<>():NodePath set get
Path to the visibility range parent for this node and its descendants. The visibility parent must be a GeometryInstance3D.

Any visual instance will only be visible if the visibility parent (and all of its visibility ancestors) is hidden by being closer to the camera than its own [member GeometryInstance3D.visibility_range_begin]. Nodes hidden via the [member Node3D.visible] property are essentially removed from the visibility dependency tree, so dependent instances will not take the hidden node or its descendants into account.
set get bool visible<>():bool set get
If true, this node can be visible. The node is only rendered when all of its ancestors are visible, as well. That means is_visible_in_tree must return true.

void add_gizmo<>( Node3DGizmo gizmo=, gizmo:Node3DGizmo=, ):void
Attaches the given gizmo to this node. Only works in the editor.

Note: gizmo should be an EditorNode3DGizmo. The argument type is Node3DGizmo to avoid depending on editor classes in Node3D.
void clear_gizmos<>():void
Clears all EditorNode3DGizmo objects attached to this node. Only works in the editor.

void clear_subgizmo_selection<>():void
Deselects all subgizmos for this node. Useful to call when the selected subgizmo may no longer exist after a property change. Only works in the editor.

void force_update_transform<>():void
Forces the node's global_transform to update, by sending NOTIFICATION_TRANSFORM_CHANGED. Fails if the node is not inside the tree.

Note: For performance reasons, transform changes are usually accumulated and applied once at the end of the frame. The update propagates through Node3D children, as well. Therefore, use this method only when you need an up-to-date transform (such as during physics operations).
Node3DGizmo[] get_gizmos<>():Node3DGizmo[]
Returns all the EditorNode3DGizmo objects attached to this node. Only works in the editor.

Transform3D get_global_transform_interpolated<>():Transform3D
When using physics interpolation, there will be circumstances in which you want to know the interpolated (displayed) transform of a node rather than the standard transform (which may only be accurate to the most recent physics tick).

This is particularly important for frame-based operations that take place in [method Node._process], rather than [method Node._physics_process]. Examples include Camera3Ds focusing on a node, or finding where to fire lasers from on a frame rather than physics tick.
Note: This function creates an interpolation pump on the Node3D the first time it is called, which can respond to physics interpolation resets. If you get problems with "streaking" when initially following a Node3D, be sure to call get_global_transform_interpolated at least once before resetting the Node3D physics interpolation.
Node3D get_parent_node_3d<>():Node3D
Returns the parent Node3D that directly affects this node's global_transform. Returns null if no parent exists, the parent is not a Node3D, or top_level is true.

Note: This method is not always equivalent to [method Node.get_parent], which does not take top_level into account.
World3D get_world_3d<>():World3D
Returns the World3D this node is registered to.

Usually, this is the same as the world used by this node's viewport (see [method Node.get_viewport] and [method Viewport.find_world_3d]).
void global_rotate<>( Vector3 axis=, axis:Vector3=, float angle=, angle:float=, ):void
Rotates this node's global_basis around the global axis by the given angle, in radians. This operation is calculated in global space (relative to the world) and preserves the global_position.

void global_scale<>( Vector3 scale=, scale:Vector3=, ):void
Scales this node's global_basis by the given scale factor. This operation is calculated in global space (relative to the world) and preserves the global_position.

Note: This method is not to be confused with the scale property.
void global_translate<>( Vector3 offset=, offset:Vector3=, ):void
Adds the given translation offset to the node's global_position in global space (relative to the world).

void hide<>():void
Prevents this node from being rendered. Equivalent to setting visible to false. This is the opposite of show.

bool is_local_transform_notification_enabled<>():bool
Returns true if the node receives NOTIFICATION_LOCAL_TRANSFORM_CHANGED whenever transform changes. This is enabled with set_notify_local_transform.

bool is_scale_disabled<>():bool
Returns true if this node's global_transform is automatically orthonormalized. This results in this node not appearing distorted, as if its global scale were set to [constant Vector3.ONE] (or its negative counterpart). See also set_disable_scale and orthonormalize.

Note: transform is not affected by this setting.
bool is_transform_notification_enabled<>():bool
Returns true if the node receives NOTIFICATION_TRANSFORM_CHANGED whenever global_transform changes. This is enabled with set_notify_transform.

bool is_visible_in_tree<>():bool
Returns true if this node is inside the scene tree and the visible property is true for this node and all of its Node3D ancestors in sequence. An ancestor of any other type (such as Node or Node2D) breaks the sequence. See also [method Node.get_parent].

Note: This method cannot take [member VisualInstance3D.layers] into account, so even if this method returns true, the node may not be rendered.
void look_at<>( Vector3 target=, target:Vector3=, Vector3 up=Vector3(0, 1, 0), up:Vector3=Vector3(0, 1, 0), bool use_model_front=false, use_model_front:bool=false, ):void
Rotates the node so that the local forward axis (-Z, [constant Vector3.FORWARD]) points toward the target position. This operation is calculated in global space (relative to the world).

The local up axis (+Y) points as close to the 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 target position cannot be the same as the node's position, the up vector cannot be [constant Vector3.ZERO]. Furthermore, the direction from the node's position to the target position cannot be parallel to the up vector, to avoid an unintended rotation around the local Z axis.
If use_model_front is true, the +Z axis (asset front) is treated as forward (implies +X is left) and points toward the target position. By default, the -Z axis (camera forward) is treated as forward (implies +X is right).
Note: This method fails if the node is not in the scene tree. If necessary, use look_at_from_position instead.
void look_at_from_position<>( Vector3 position=, position:Vector3=, Vector3 target=, target:Vector3=, Vector3 up=Vector3(0, 1, 0), up:Vector3=Vector3(0, 1, 0), bool use_model_front=false, use_model_front:bool=false, ):void
Moves the node to the specified position, then rotates the node to point toward the target position, similar to look_at. This operation is calculated in global space (relative to the world).

void orthonormalize<>():void
Orthonormalizes this node's basis. This method sets this node's scale to [constant Vector3.ONE] (or its negative counterpart), but preserves the position and rotation. See also [method Transform3D.orthonormalized].

void rotate<>( Vector3 axis=, axis:Vector3=, float angle=, angle:float=, ):void
Rotates this node's basis around the axis by the given angle, in radians. This operation is calculated in parent space (relative to the parent) and preserves the position.

void rotate_object_local<>( Vector3 axis=, axis:Vector3=, float angle=, angle:float=, ):void
Rotates this node's basis around the axis by the given angle, in radians. This operation is calculated in local space (relative to this node) and preserves the position.

void rotate_x<>( float angle=, angle:float=, ):void
Rotates this node's basis around the X axis by the given angle, in radians. This operation is calculated in parent space (relative to the parent) and preserves the position.

void rotate_y<>( float angle=, angle:float=, ):void
Rotates this node's basis around the Y axis by the given angle, in radians. This operation is calculated in parent space (relative to the parent) and preserves the position.

void rotate_z<>( float angle=, angle:float=, ):void
Rotates this node's basis around the Z axis by the given angle, in radians. This operation is calculated in parent space (relative to the parent) and preserves the position.

void scale_object_local<>( Vector3 scale=, scale:Vector3=, ):void
Scales this node's basis by the given scale factor. This operation is calculated in local space (relative to this node) and preserves the position.

void set_disable_scale<>( bool disable=, disable:bool=, ):void
If true, this node's global_transform is automatically orthonormalized. This results in this node not appearing distorted, as if its global scale were set to [constant Vector3.ONE] (or its negative counterpart). See also is_scale_disabled and orthonormalize.

Note: transform is not affected by this setting.
void set_identity<>():void
Sets this node's transform to [constant Transform3D.IDENTITY], which resets all transformations in parent space (position, rotation, and scale).

void set_ignore_transform_notification<>( bool enabled=, enabled:bool=, ):void

It may useful to call this method when handling these notifications to prevent infinite recursion.
void set_notify_local_transform<>( bool enable=, enable:bool=, ):void
If true, the node will receive NOTIFICATION_LOCAL_TRANSFORM_CHANGED whenever transform changes.

Note: Some 3D nodes such as CSGShape3D or CollisionShape3D automatically enable this to function correctly.
void set_notify_transform<>( bool enable=, enable:bool=, ):void
If true, the node will receive NOTIFICATION_TRANSFORM_CHANGED whenever global_transform changes.

Note: Most 3D nodes such as VisualInstance3D or CollisionObject3D automatically enable this to function correctly.
Note: In the editor, nodes will propagate this notification to their children if a gizmo is attached (see add_gizmo).
void set_subgizmo_selection<>( Node3DGizmo gizmo=, gizmo:Node3DGizmo=, int id=, id:int=, Transform3D transform=, transform:Transform3D=, ):void
Selects the gizmo's subgizmo with the given id and sets its transform. Only works in the editor.

Note: 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.
void show<>():void
Allows this node to be rendered. Equivalent to setting visible to true. This is the opposite of hide.

Vector3 to_global<>( Vector3 local_point=, local_point:Vector3=, ):Vector3
Returns the local_point converted from this node's local space to global space. This is the opposite of to_local.

Vector3 to_local<>( Vector3 global_point=, global_point:Vector3=, ):Vector3
Returns the global_point converted from global space to this node's local space. This is the opposite of to_global.

void translate<>( Vector3 offset=, offset:Vector3=, ):void
Adds the given translation offset to the node's position, in local space (relative to this node).

Note: Prefer using translate_object_local, instead, as this method may be changed in a future release.
Note: Despite the naming convention, this operation is not calculated in parent space for compatibility reasons. To translate in parent space, add offset to the position (node_3d.position += offset).
void translate_object_local<>( Vector3 offset=, offset:Vector3=, ):void
Adds the given translation offset to the node's position, in local space (relative to this node).

void update_gizmos<>():void
Updates all the EditorNode3DGizmo objects attached to this node. Only works in the editor.




All social media brands are registrated trademarks and belong to their respective owners.





CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
CONTACT IMPRINT TERMS OF USE PRIVACY © ROKOROJI ® 2021 rokojori.com
We are using cookies on this site. Read more... Wir benutzen Cookies auf dieser Seite. Mehr lesen...