Struct Fabrik3d
pub struct Fabrik3d { /* private fields */ }Expand description
Godot class FABRIK3D.
Inherits IterateIk3d.
Related symbols:
IFabrik3d: virtual methods
See also Godot docs for FABRIK3D.
§Construction
This class is manually managed. You can create a new instance using Fabrik3d::new_alloc().
Do not forget to call free() or hand over ownership to Godot.
§Godot docs
FABRIK3D is position based IK, allowing precise and accurate tracking of targets. It’s ideal for simple chains without limitations.
The resulting twist around the forward vector will always be kept from the previous pose.
Note: When the target is close to the root, it tends to produce zig-zag patterns, resulting in unnatural visual movement.
Methods from Deref<Target = IterateIk3d>§
pub fn set_max_iterations(&mut self, max_iterations: i32)
pub fn get_max_iterations(&self) -> i32
pub fn set_min_distance(&mut self, min_distance: f64)
pub fn get_min_distance(&self) -> f64
pub fn set_angular_delta_limit(&mut self, angular_delta_limit: f64)
pub fn get_angular_delta_limit(&self) -> f64
pub fn set_deterministic(&mut self, deterministic: bool)
pub fn is_deterministic(&self) -> bool
pub fn set_target_node(&mut self, index: i32, target_node: impl AsArg<NodePath>)
pub fn set_target_node(&mut self, index: i32, target_node: impl AsArg<NodePath>)
Sets the target node that the end bone is trying to reach.
pub fn get_target_node(&self, index: i32) -> NodePath
pub fn get_target_node(&self, index: i32) -> NodePath
Returns the target node that the end bone is trying to reach.
pub fn set_joint_rotation_axis(
&mut self,
index: i32,
joint: i32,
axis: RotationAxis,
)
pub fn set_joint_rotation_axis( &mut self, index: i32, joint: i32, axis: RotationAxis, )
Sets the rotation axis at joint in the bone chain’s joint list.
The axes are based on the get_bone_rest’s space, if axis is RotationAxis::CUSTOM, you can specify any axis.
Note: The rotation axis and the forward vector shouldn’t be colinear to avoid unintended rotation since ChainIK3D does not factor in twisting forces.
pub fn get_joint_rotation_axis(&self, index: i32, joint: i32) -> RotationAxis
pub fn get_joint_rotation_axis(&self, index: i32, joint: i32) -> RotationAxis
Returns the rotation axis at joint in the bone chain’s joint list.
pub fn set_joint_rotation_axis_vector(
&mut self,
index: i32,
joint: i32,
axis_vector: Vector3,
)
pub fn set_joint_rotation_axis_vector( &mut self, index: i32, joint: i32, axis_vector: Vector3, )
Sets the rotation axis vector for the specified joint in the bone chain.
This vector is normalized by an internal process and represents the axis around which the bone chain can rotate.
If the vector length is 0, it is considered synonymous with RotationAxis::ALL.
pub fn get_joint_rotation_axis_vector(&self, index: i32, joint: i32) -> Vector3
pub fn get_joint_rotation_axis_vector(&self, index: i32, joint: i32) -> Vector3
Returns the rotation axis vector for the specified joint in the bone chain. This vector represents the axis around which the joint can rotate. It is determined based on the rotation axis set for the joint.
If get_joint_rotation_axis is RotationAxis::ALL, this method returns Vector3(0, 0, 0).
pub fn set_joint_limitation(
&mut self,
index: i32,
joint: i32,
limitation: impl AsArg<Option<Gd<JointLimitation3D>>>,
)
pub fn set_joint_limitation( &mut self, index: i32, joint: i32, limitation: impl AsArg<Option<Gd<JointLimitation3D>>>, )
Sets the joint limitation at joint in the bone chain’s joint list.
pub fn get_joint_limitation(
&self,
index: i32,
joint: i32,
) -> Option<Gd<JointLimitation3D>>
pub fn get_joint_limitation( &self, index: i32, joint: i32, ) -> Option<Gd<JointLimitation3D>>
Returns the joint limitation at joint in the bone chain’s joint list.
pub fn set_joint_limitation_right_axis(
&mut self,
index: i32,
joint: i32,
direction: SecondaryDirection,
)
pub fn set_joint_limitation_right_axis( &mut self, index: i32, joint: i32, direction: SecondaryDirection, )
Sets the joint limitation right axis at joint in the bone chain’s joint list.
pub fn get_joint_limitation_right_axis(
&self,
index: i32,
joint: i32,
) -> SecondaryDirection
pub fn get_joint_limitation_right_axis( &self, index: i32, joint: i32, ) -> SecondaryDirection
Returns the joint limitation right axis at joint in the bone chain’s joint list.
pub fn set_joint_limitation_right_axis_vector(
&mut self,
index: i32,
joint: i32,
vector: Vector3,
)
pub fn set_joint_limitation_right_axis_vector( &mut self, index: i32, joint: i32, vector: Vector3, )
Sets the optional joint limitation right axis vector at joint in the bone chain’s joint list.
pub fn get_joint_limitation_right_axis_vector(
&self,
index: i32,
joint: i32,
) -> Vector3
pub fn get_joint_limitation_right_axis_vector( &self, index: i32, joint: i32, ) -> Vector3
Returns the joint limitation right axis vector at joint in the bone chain’s joint list.
If get_joint_limitation_right_axis is SecondaryDirection::NONE, this method returns Vector3(0, 0, 0).
pub fn set_joint_limitation_rotation_offset(
&mut self,
index: i32,
joint: i32,
offset: Quaternion,
)
pub fn set_joint_limitation_rotation_offset( &mut self, index: i32, joint: i32, offset: Quaternion, )
Sets the joint limitation rotation offset at joint in the bone chain’s joint list.
Rotation is done in the local space which is constructed by the bone direction (in general parent to child) as the +Y axis and get_joint_limitation_right_axis_vector as the +X axis.
If the +X and +Y axes are not orthogonal, the +X axis is implicitly modified to make it orthogonal.
Also, if the length of get_joint_limitation_right_axis_vector is zero, the space is created by rotating the bone rest using the shortest arc that rotates the +Y axis of the bone rest to match the bone direction.
pub fn get_joint_limitation_rotation_offset(
&self,
index: i32,
joint: i32,
) -> Quaternion
pub fn get_joint_limitation_rotation_offset( &self, index: i32, joint: i32, ) -> Quaternion
Returns the joint limitation rotation offset at joint in the bone chain’s joint list.
Rotation is done in the local space which is constructed by the bone direction (in general parent to child) as the +Y axis and get_joint_limitation_right_axis_vector as the +X axis.
If the +X and +Y axes are not orthogonal, the +X axis is implicitly modified to make it orthogonal.
Also, if the length of get_joint_limitation_right_axis_vector is zero, the space is created by rotating the bone rest using the shortest arc that rotates the +Y axis of the bone rest to match the bone direction.
Methods from Deref<Target = ChainIk3d>§
pub fn set_root_bone_name(&mut self, index: i32, bone_name: impl AsArg<GString>)
pub fn set_root_bone_name(&mut self, index: i32, bone_name: impl AsArg<GString>)
Sets the root bone name of the bone chain.
pub fn get_root_bone_name(&self, index: i32) -> GString
pub fn get_root_bone_name(&self, index: i32) -> GString
Returns the root bone name of the bone chain.
pub fn set_root_bone(&mut self, index: i32, bone: i32)
pub fn set_root_bone(&mut self, index: i32, bone: i32)
Sets the root bone index of the bone chain.
pub fn get_root_bone(&self, index: i32) -> i32
pub fn get_root_bone(&self, index: i32) -> i32
Returns the root bone index of the bone chain.
pub fn set_end_bone_name(&mut self, index: i32, bone_name: impl AsArg<GString>)
pub fn set_end_bone_name(&mut self, index: i32, bone_name: impl AsArg<GString>)
Sets the end bone name of the bone chain.
Note: The end bone must be the root bone or a child of the root bone. If they are the same, the tail must be extended by set_extend_end_bone to modify the bone.
pub fn get_end_bone_name(&self, index: i32) -> GString
pub fn get_end_bone_name(&self, index: i32) -> GString
Returns the end bone name of the bone chain.
pub fn set_end_bone(&mut self, index: i32, bone: i32)
pub fn set_end_bone(&mut self, index: i32, bone: i32)
Sets the end bone index of the bone chain.
pub fn get_end_bone(&self, index: i32) -> i32
pub fn get_end_bone(&self, index: i32) -> i32
Returns the end bone index of the bone chain.
pub fn set_extend_end_bone(&mut self, index: i32, enabled: bool)
pub fn set_extend_end_bone(&mut self, index: i32, enabled: bool)
If enabled is true, the end bone is extended to have a tail.
The extended tail config is allocated to the last element in the joint list. In other words, if you set enabled to false, the config of the last element in the joint list has no effect in the simulated result.
pub fn is_end_bone_extended(&self, index: i32) -> bool
pub fn is_end_bone_extended(&self, index: i32) -> bool
Returns true if the end bone is extended to have a tail.
pub fn set_end_bone_direction(
&mut self,
index: i32,
bone_direction: BoneDirection,
)
pub fn set_end_bone_direction( &mut self, index: i32, bone_direction: BoneDirection, )
Sets the end bone tail direction of the bone chain when is_end_bone_extended is true.
pub fn get_end_bone_direction(&self, index: i32) -> BoneDirection
pub fn get_end_bone_direction(&self, index: i32) -> BoneDirection
Returns the tail direction of the end bone of the bone chain when is_end_bone_extended is true.
pub fn set_end_bone_length(&mut self, index: i32, length: f32)
pub fn set_end_bone_length(&mut self, index: i32, length: f32)
Sets the end bone tail length of the bone chain when is_end_bone_extended is true.
pub fn get_end_bone_length(&self, index: i32) -> f32
pub fn get_end_bone_length(&self, index: i32) -> f32
Returns the end bone tail length of the bone chain when is_end_bone_extended is true.
pub fn get_joint_bone_name(&self, index: i32, joint: i32) -> GString
pub fn get_joint_bone_name(&self, index: i32, joint: i32) -> GString
Returns the bone name at joint in the bone chain’s joint list.
pub fn get_joint_bone(&self, index: i32, joint: i32) -> i32
pub fn get_joint_bone(&self, index: i32, joint: i32) -> i32
Returns the bone index at joint in the bone chain’s joint list.
pub fn get_joint_count(&self, index: i32) -> i32
pub fn get_joint_count(&self, index: i32) -> i32
Returns the joint count of the bone chain’s joint list.
Methods from Deref<Target = IkModifier3D>§
pub fn set_setting_count(&mut self, count: i32)
pub fn set_setting_count(&mut self, count: i32)
Sets the number of settings.
pub fn get_setting_count(&self) -> i32
pub fn get_setting_count(&self) -> i32
Returns the number of settings.
pub fn clear_settings(&mut self)
pub fn clear_settings(&mut self)
Clears all settings.
pub fn set_mutable_bone_axes(&mut self, enabled: bool)
pub fn are_bone_axes_mutable(&self) -> bool
pub fn reset(&mut self)
pub fn reset(&mut self)
Resets a state with respect to the current bone pose.
Methods from Deref<Target = SkeletonModifier3D>§
pub fn get_skeleton(&self) -> Option<Gd<Skeleton3D>>
pub fn get_skeleton(&self) -> Option<Gd<Skeleton3D>>
Returns the parent Skeleton3D node if it exists. Otherwise, returns null.
pub fn set_active(&mut self, active: bool)
pub fn is_active(&self) -> bool
pub fn set_influence(&mut self, influence: f32)
pub fn get_influence(&self) -> f32
Methods from Deref<Target = Node3D>§
pub fn set_transform(&mut self, local: Transform3D)
pub fn get_transform(&self) -> Transform3D
pub fn set_position(&mut self, position: Vector3)
pub fn get_position(&self) -> Vector3
pub fn set_rotation(&mut self, euler_radians: Vector3)
pub fn get_rotation(&self) -> Vector3
pub fn set_rotation_degrees(&mut self, euler_degrees: Vector3)
pub fn get_rotation_degrees(&self) -> Vector3
pub fn set_rotation_order(&mut self, order: EulerOrder)
pub fn get_rotation_order(&self) -> EulerOrder
pub fn set_rotation_edit_mode(&mut self, edit_mode: RotationEditMode)
pub fn get_rotation_edit_mode(&self) -> RotationEditMode
pub fn set_scale(&mut self, scale: Vector3)
pub fn get_scale(&self) -> Vector3
pub fn set_quaternion(&mut self, quaternion: Quaternion)
pub fn get_quaternion(&self) -> Quaternion
pub fn set_basis(&mut self, basis: Basis)
pub fn get_basis(&self) -> Basis
pub fn set_global_transform(&mut self, global: Transform3D)
pub fn get_global_transform(&self) -> Transform3D
pub fn get_global_transform_interpolated(&mut self) -> Transform3D
pub fn get_global_transform_interpolated(&mut self) -> 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 process, rather than 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.
pub fn set_global_position(&mut self, position: Vector3)
pub fn get_global_position(&self) -> Vector3
pub fn set_global_basis(&mut self, basis: Basis)
pub fn get_global_basis(&self) -> Basis
pub fn set_global_rotation(&mut self, euler_radians: Vector3)
pub fn get_global_rotation(&self) -> Vector3
pub fn set_global_rotation_degrees(&mut self, euler_degrees: Vector3)
pub fn get_global_rotation_degrees(&self) -> Vector3
pub fn get_parent_node_3d(&self) -> Option<Gd<Node3D>>
pub fn get_parent_node_3d(&self) -> Option<Gd<Node3D>>
Returns the parent Node3D that directly affects this node’s [member global_transform]. Returns null if no parent exists, the parent is not a Node3D, or [member top_level] is true.
Note: This method is not always equivalent to get_parent, which does not take [member top_level] into account.
pub fn set_ignore_transform_notification(&mut self, enabled: bool)
pub fn set_ignore_transform_notification(&mut self, enabled: bool)
If true, the node will not receive Node3DNotification::TRANSFORM_CHANGED or Node3DNotification::LOCAL_TRANSFORM_CHANGED.
It may useful to call this method when handling these notifications to prevent infinite recursion.
pub fn set_as_top_level(&mut self, enable: bool)
pub fn is_set_as_top_level(&self) -> bool
pub fn set_disable_scale(&mut self, disable: bool)
pub fn set_disable_scale(&mut self, disable: bool)
If true, this node’s [member global_transform] is automatically orthonormalized. This results in this node not appearing distorted, as if its global scale were set to Vector3.ONE (or its negative counterpart). See also is_scale_disabled and orthonormalize.
Note: [member transform] is not affected by this setting.
pub fn is_scale_disabled(&self) -> bool
pub fn is_scale_disabled(&self) -> bool
Returns true if this node’s [member global_transform] is automatically orthonormalized. This results in this node not appearing distorted, as if its global scale were set to Vector3.ONE (or its negative counterpart). See also set_disable_scale and orthonormalize.
Note: [member transform] is not affected by this setting.
pub fn get_world_3d(&self) -> Option<Gd<World3D>>
pub fn get_world_3d(&self) -> Option<Gd<World3D>>
Returns the World3D this node is registered to.
Usually, this is the same as the world used by this node’s viewport (see get_viewport and find_world_3d).
pub fn force_update_transform(&mut self)
pub fn force_update_transform(&mut self)
Forces the node’s [member global_transform] to update, by sending Node3DNotification::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).
pub fn set_visibility_parent(&mut self, path: impl AsArg<NodePath>)
pub fn get_visibility_parent(&self) -> NodePath
pub fn update_gizmos(&mut self)
pub fn update_gizmos(&mut self)
Updates all the EditorNode3DGizmo objects attached to this node. Only works in the editor.
pub fn add_gizmo(&mut self, gizmo: impl AsArg<Option<Gd<Node3DGizmo>>>)
pub fn add_gizmo(&mut self, gizmo: impl AsArg<Option<Gd<Node3DGizmo>>>)
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.
pub fn get_gizmos(&self) -> Array<Gd<Node3DGizmo>>
pub fn get_gizmos(&self) -> Array<Gd<Node3DGizmo>>
Returns all the EditorNode3DGizmo objects attached to this node. Only works in the editor.
pub fn clear_gizmos(&mut self)
pub fn clear_gizmos(&mut self)
Clears all EditorNode3DGizmo objects attached to this node. Only works in the editor.
pub fn set_subgizmo_selection(
&mut self,
gizmo: impl AsArg<Option<Gd<Node3DGizmo>>>,
id: i32,
transform: Transform3D,
)
pub fn set_subgizmo_selection( &mut self, gizmo: impl AsArg<Option<Gd<Node3DGizmo>>>, id: i32, transform: Transform3D, )
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.
pub fn clear_subgizmo_selection(&mut self)
pub fn clear_subgizmo_selection(&mut self)
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.
pub fn set_visible(&mut self, visible: bool)
pub fn is_visible(&self) -> bool
pub fn is_visible_in_tree(&self) -> bool
pub fn is_visible_in_tree(&self) -> bool
Returns true if this node is inside the scene tree and the [member 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 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.
pub fn show(&mut self)
pub fn show(&mut self)
Allows this node to be rendered. Equivalent to setting [member visible] to true. This is the opposite of hide.
pub fn hide(&mut self)
pub fn hide(&mut self)
Prevents this node from being rendered. Equivalent to setting [member visible] to false. This is the opposite of show.
pub fn set_notify_local_transform(&mut self, enable: bool)
pub fn set_notify_local_transform(&mut self, enable: bool)
If true, the node will receive Node3DNotification::LOCAL_TRANSFORM_CHANGED whenever [member transform] changes.
Note: Some 3D nodes such as CSGShape3D or CollisionShape3D automatically enable this to function correctly.
pub fn is_local_transform_notification_enabled(&self) -> bool
pub fn is_local_transform_notification_enabled(&self) -> bool
Returns true if the node receives Node3DNotification::LOCAL_TRANSFORM_CHANGED whenever [member transform] changes. This is enabled with set_notify_local_transform.
pub fn set_notify_transform(&mut self, enable: bool)
pub fn set_notify_transform(&mut self, enable: bool)
If true, the node will receive Node3DNotification::TRANSFORM_CHANGED whenever [member 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).
pub fn is_transform_notification_enabled(&self) -> bool
pub fn is_transform_notification_enabled(&self) -> bool
Returns true if the node receives Node3DNotification::TRANSFORM_CHANGED whenever [member global_transform] changes. This is enabled with set_notify_transform.
pub fn rotate(&mut self, axis: Vector3, angle: f32)
pub fn rotate(&mut self, axis: Vector3, angle: f32)
Rotates this node’s [member basis] around the axis by the given angle, in radians. This operation is calculated in parent space (relative to the parent) and preserves the [member position].
pub fn global_rotate(&mut self, axis: Vector3, angle: f32)
pub fn global_rotate(&mut self, axis: Vector3, angle: f32)
Rotates this node’s [member 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 [member global_position].
pub fn global_scale(&mut self, scale: Vector3)
pub fn global_scale(&mut self, scale: Vector3)
Scales this node’s [member global_basis] by the given scale factor. This operation is calculated in global space (relative to the world) and preserves the [member global_position].
Note: This method is not to be confused with the [member scale] property.
pub fn global_translate(&mut self, offset: Vector3)
pub fn global_translate(&mut self, offset: Vector3)
Adds the given translation offset to the node’s [member global_position] in global space (relative to the world).
pub fn rotate_object_local(&mut self, axis: Vector3, angle: f32)
pub fn rotate_object_local(&mut self, axis: Vector3, angle: f32)
Rotates this node’s [member basis] around the axis by the given angle, in radians. This operation is calculated in local space (relative to this node) and preserves the [member position].
pub fn scale_object_local(&mut self, scale: Vector3)
pub fn scale_object_local(&mut self, scale: Vector3)
Scales this node’s [member basis] by the given scale factor. This operation is calculated in local space (relative to this node) and preserves the [member position].
pub fn translate_object_local(&mut self, offset: Vector3)
pub fn translate_object_local(&mut self, offset: Vector3)
Adds the given translation offset to the node’s position, in local space (relative to this node).
pub fn rotate_x(&mut self, angle: f32)
pub fn rotate_x(&mut self, angle: f32)
Rotates this node’s [member 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 [member position].
pub fn rotate_y(&mut self, angle: f32)
pub fn rotate_y(&mut self, angle: f32)
Rotates this node’s [member 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 [member position].
pub fn rotate_z(&mut self, angle: f32)
pub fn rotate_z(&mut self, angle: f32)
Rotates this node’s [member 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 [member position].
pub fn translate(&mut self, offset: Vector3)
pub fn translate(&mut self, offset: Vector3)
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 [member position] (node_3d.position += offset).
pub fn orthonormalize(&mut self)
pub fn orthonormalize(&mut self)
Orthonormalizes this node’s [member basis]. This method sets this node’s [member scale] to Vector3.ONE (or its negative counterpart), but preserves the [member position] and [member rotation]. See also orthonormalized.
pub fn set_identity(&mut self)
pub fn set_identity(&mut self)
Sets this node’s [member transform] to Transform3D.IDENTITY, which resets all transformations in parent space ([member position], [member rotation], and [member scale]).
pub fn look_at(&mut self, target: Vector3)
pub fn look_at(&mut self, target: Vector3)
To set the default parameters, use look_at_ex and its builder methods. See the book for detailed usage instructions.
Rotates the node so that the local forward axis (-Z, 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 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.
pub fn look_at_ex<'ex>(&'ex mut self, target: Vector3) -> ExLookAt<'ex>
pub fn look_at_ex<'ex>(&'ex mut self, target: Vector3) -> ExLookAt<'ex>
Rotates the node so that the local forward axis (-Z, 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 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.
pub fn look_at_from_position(&mut self, position: Vector3, target: Vector3)
pub fn look_at_from_position(&mut self, position: Vector3, target: Vector3)
To set the default parameters, use look_at_from_position_ex and its builder methods. See the book for detailed usage instructions.
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).
pub fn look_at_from_position_ex<'ex>(
&'ex mut self,
position: Vector3,
target: Vector3,
) -> ExLookAtFromPosition<'ex>
pub fn look_at_from_position_ex<'ex>( &'ex mut self, position: Vector3, target: Vector3, ) -> ExLookAtFromPosition<'ex>
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).
pub fn to_local(&self, global_point: Vector3) -> Vector3
pub fn to_local(&self, 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.
pub fn to_global(&self, local_point: Vector3) -> Vector3
pub fn to_global(&self, 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.
pub fn notify(&mut self, what: Node3DNotification)
pub fn notify(&mut self, what: Node3DNotification)
⚠️ Sends a Godot notification to all classes inherited by the object.
Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().
Starts from the highest ancestor (the Object class) and goes down the hierarchy.
See also Godot docs for Object::notification().
§Panics
If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter
a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must
be exclusive.
pub fn notify_reversed(&mut self, what: Node3DNotification)
pub fn notify_reversed(&mut self, what: Node3DNotification)
⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.
See docs of that method, including the panics.
Methods from Deref<Target = Node>§
pub fn get_node_as<T>(&self, path: impl AsArg<NodePath>) -> Gd<T>
pub fn get_node_as<T>(&self, path: impl AsArg<NodePath>) -> Gd<T>
⚠️ Retrieves the node at path path, panicking if not found or bad type.
§Panics
If the node is not found, or if it does not have type T or inherited.
pub fn try_get_node_as<T>(&self, path: impl AsArg<NodePath>) -> Option<Gd<T>>
pub fn try_get_node_as<T>(&self, path: impl AsArg<NodePath>) -> Option<Gd<T>>
Retrieves the node at path path (fallible).
If the node is not found, or if it does not have type T or inherited,
None will be returned.
pub fn get_tree(&self) -> Gd<SceneTree>
pub fn get_tree(&self) -> Gd<SceneTree>
⚠️ Assuming the node is inside a scene tree, obtains the latter.
§Panics
If the node is not inside the scene tree. If you’re unsure, use get_tree_or_null().
pub fn get_tree_or_null(&self) -> Option<Gd<SceneTree>>
pub fn get_tree_or_null(&self) -> Option<Gd<SceneTree>>
Fallibly obtains the scene tree containing the node, or None.
pub fn add_sibling(&mut self, sibling: impl AsArg<Gd<Node>>)
pub fn add_sibling(&mut self, sibling: impl AsArg<Gd<Node>>)
To set the default parameters, use add_sibling_ex and its builder methods. See the book for detailed usage instructions.
Adds a sibling node to this node’s parent, and moves the added sibling right below this node.
If force_readable_name is true, improves the readability of the added sibling. If not named, the sibling is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.
Use add_child instead of this method if you don’t need the child node to be added below a specific node in the list of children.
Note: If this node is internal, the added sibling will be internal too (see add_child’s internal parameter).
pub fn add_sibling_ex<'ex>(
&'ex mut self,
sibling: impl AsArg<Gd<Node>> + 'ex,
) -> ExAddSibling<'ex>
pub fn add_sibling_ex<'ex>( &'ex mut self, sibling: impl AsArg<Gd<Node>> + 'ex, ) -> ExAddSibling<'ex>
Adds a sibling node to this node’s parent, and moves the added sibling right below this node.
If force_readable_name is true, improves the readability of the added sibling. If not named, the sibling is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.
Use add_child instead of this method if you don’t need the child node to be added below a specific node in the list of children.
Note: If this node is internal, the added sibling will be internal too (see add_child’s internal parameter).
pub fn set_name(&mut self, name: impl AsArg<StringName>)
pub fn get_name(&self) -> StringName
pub fn add_child(&mut self, node: impl AsArg<Gd<Node>>)
pub fn add_child(&mut self, node: impl AsArg<Gd<Node>>)
To set the default parameters, use add_child_ex and its builder methods. See the book for detailed usage instructions.
Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.
If force_readable_name is true, improves the readability of the added node. If not named, the node is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.
If internal is different than InternalMode::DISABLED, the child will be added as internal node. These nodes are ignored by methods like get_children, unless their parameter include_internal is true. It also prevents these nodes being duplicated with their parent. The intended usage is to hide the internal nodes from the user, so the user won’t accidentally delete or modify them. Used by some GUI nodes, e.g. ColorPicker.
Note: If node already has a parent, this method will fail. Use remove_child first to remove node from its current parent. For example:
var child_node = get_child(0)
if child_node.get_parent():
child_node.get_parent().remove_child(child_node)
add_child(child_node)If you need the child node to be added below a specific node in the list of children, use add_sibling instead of this method.
Note: If you want a child to be persisted to a PackedScene, you must set [member owner] in addition to calling add_child. This is typically relevant for tool scripts and editor plugins. If add_child is called without setting [member owner], the newly added Node will not be visible in the scene tree, though it will be visible in the 2D/3D view.
pub fn add_child_ex<'ex>(
&'ex mut self,
node: impl AsArg<Gd<Node>> + 'ex,
) -> ExAddChild<'ex>
pub fn add_child_ex<'ex>( &'ex mut self, node: impl AsArg<Gd<Node>> + 'ex, ) -> ExAddChild<'ex>
Adds a child node. Nodes can have any number of children, but every child must have a unique name. Child nodes are automatically deleted when the parent node is deleted, so an entire scene can be removed by deleting its topmost node.
If force_readable_name is true, improves the readability of the added node. If not named, the node is renamed to its type, and if it shares [member name] with a sibling, a number is suffixed more appropriately. This operation is very slow. As such, it is recommended leaving this to false, which assigns a dummy name featuring @ in both situations.
If internal is different than InternalMode::DISABLED, the child will be added as internal node. These nodes are ignored by methods like get_children, unless their parameter include_internal is true. It also prevents these nodes being duplicated with their parent. The intended usage is to hide the internal nodes from the user, so the user won’t accidentally delete or modify them. Used by some GUI nodes, e.g. ColorPicker.
Note: If node already has a parent, this method will fail. Use remove_child first to remove node from its current parent. For example:
var child_node = get_child(0)
if child_node.get_parent():
child_node.get_parent().remove_child(child_node)
add_child(child_node)If you need the child node to be added below a specific node in the list of children, use add_sibling instead of this method.
Note: If you want a child to be persisted to a PackedScene, you must set [member owner] in addition to calling add_child. This is typically relevant for tool scripts and editor plugins. If add_child is called without setting [member owner], the newly added Node will not be visible in the scene tree, though it will be visible in the 2D/3D view.
pub fn remove_child(&mut self, node: impl AsArg<Gd<Node>>)
pub fn remove_child(&mut self, node: impl AsArg<Gd<Node>>)
Removes a child node. The node, along with its children, are not deleted. To delete a node, see queue_free.
Note: When this node is inside the tree, this method sets the [member owner] of the removed node (or its descendants) to null, if their [member owner] is no longer an ancestor (see is_ancestor_of).
pub fn reparent(&mut self, new_parent: impl AsArg<Gd<Node>>)
pub fn reparent(&mut self, new_parent: impl AsArg<Gd<Node>>)
To set the default parameters, use reparent_ex and its builder methods. See the book for detailed usage instructions.
Changes the parent of this Node to the new_parent. The node needs to already have a parent. The node’s [member owner] is preserved if its owner is still reachable from the new location (i.e., the node is still a descendant of the new parent after the operation).
If keep_global_transform is true, the node’s global transform will be preserved if supported. Node2D, Node3D and Control support this argument (but Control keeps only position).
pub fn reparent_ex<'ex>(
&'ex mut self,
new_parent: impl AsArg<Gd<Node>> + 'ex,
) -> ExReparent<'ex>
pub fn reparent_ex<'ex>( &'ex mut self, new_parent: impl AsArg<Gd<Node>> + 'ex, ) -> ExReparent<'ex>
Changes the parent of this Node to the new_parent. The node needs to already have a parent. The node’s [member owner] is preserved if its owner is still reachable from the new location (i.e., the node is still a descendant of the new parent after the operation).
If keep_global_transform is true, the node’s global transform will be preserved if supported. Node2D, Node3D and Control support this argument (but Control keeps only position).
pub fn get_child_count(&self) -> i32
pub fn get_child_count(&self) -> i32
To set the default parameters, use get_child_count_ex and its builder methods. See the book for detailed usage instructions.
Returns the number of children of this node.
If include_internal is false, internal children are not counted (see add_child’s internal parameter).
pub fn get_child_count_ex<'ex>(&'ex self) -> ExGetChildCount<'ex>
pub fn get_child_count_ex<'ex>(&'ex self) -> ExGetChildCount<'ex>
Returns the number of children of this node.
If include_internal is false, internal children are not counted (see add_child’s internal parameter).
pub fn get_children(&self) -> Array<Gd<Node>>
pub fn get_children(&self) -> Array<Gd<Node>>
To set the default parameters, use get_children_ex and its builder methods. See the book for detailed usage instructions.
Returns all children of this node inside an Array.
If include_internal is false, excludes internal children from the returned array (see add_child’s internal parameter).
pub fn get_children_ex<'ex>(&'ex self) -> ExGetChildren<'ex>
pub fn get_children_ex<'ex>(&'ex self) -> ExGetChildren<'ex>
pub fn get_child(&self, idx: i32) -> Option<Gd<Node>>
pub fn get_child(&self, idx: i32) -> Option<Gd<Node>>
To set the default parameters, use get_child_ex and its builder methods. See the book for detailed usage instructions.
Fetches a child node by its index. Each child node has an index relative to its siblings (see get_index). The first child is at index 0. Negative values can also be used to start from the end of the list. This method can be used in combination with get_child_count to iterate over this node’s children. If no child exists at the given index, this method returns null and an error is generated.
If include_internal is false, internal children are ignored (see add_child’s internal parameter).
# Assuming the following are children of this node, in order:
# First, Middle, Last.
var a = get_child(0).name # a is "First"
var b = get_child(1).name # b is "Middle"
var b = get_child(2).name # b is "Last"
var c = get_child(-1).name # c is "Last"Note: To fetch a node by NodePath, use get_node_as.
pub fn get_child_ex<'ex>(&'ex self, idx: i32) -> ExGetChild<'ex>
pub fn get_child_ex<'ex>(&'ex self, idx: i32) -> ExGetChild<'ex>
Fetches a child node by its index. Each child node has an index relative to its siblings (see get_index). The first child is at index 0. Negative values can also be used to start from the end of the list. This method can be used in combination with get_child_count to iterate over this node’s children. If no child exists at the given index, this method returns null and an error is generated.
If include_internal is false, internal children are ignored (see add_child’s internal parameter).
# Assuming the following are children of this node, in order:
# First, Middle, Last.
var a = get_child(0).name # a is "First"
var b = get_child(1).name # b is "Middle"
var b = get_child(2).name # b is "Last"
var c = get_child(-1).name # c is "Last"Note: To fetch a node by NodePath, use get_node_as.
pub fn has_node(&self, path: impl AsArg<NodePath>) -> bool
pub fn has_node(&self, path: impl AsArg<NodePath>) -> bool
Returns true if the path points to a valid node. See also get_node_as.
pub fn get_node_or_null(&self, path: impl AsArg<NodePath>) -> Option<Gd<Node>>
pub fn get_node_or_null(&self, path: impl AsArg<NodePath>) -> Option<Gd<Node>>
Fetches a node by NodePath. Similar to get_node_as, but does not generate an error if path does not point to a valid node.
pub fn get_parent(&self) -> Option<Gd<Node>>
pub fn get_parent(&self) -> Option<Gd<Node>>
Returns this node’s parent node, or null if the node doesn’t have a parent.
pub fn find_child(&self, pattern: impl AsArg<GString>) -> Option<Gd<Node>>
pub fn find_child(&self, pattern: impl AsArg<GString>) -> Option<Gd<Node>>
To set the default parameters, use find_child_ex and its builder methods. See the book for detailed usage instructions.
Finds the first descendant of this node whose [member name] matches pattern, returning null if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.
If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).
If owned is true, only descendants with a valid [member owner] node are checked.
Note: This method can be very slow. Consider storing a reference to the found node in a variable. Alternatively, use get_node_as with unique names (see [member unique_name_in_owner]).
Note: To find all descendant nodes matching a pattern or a class type, see find_children.
pub fn find_child_ex<'ex>(
&'ex self,
pattern: impl AsArg<GString> + 'ex,
) -> ExFindChild<'ex>
pub fn find_child_ex<'ex>( &'ex self, pattern: impl AsArg<GString> + 'ex, ) -> ExFindChild<'ex>
Finds the first descendant of this node whose [member name] matches pattern, returning null if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.
If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).
If owned is true, only descendants with a valid [member owner] node are checked.
Note: This method can be very slow. Consider storing a reference to the found node in a variable. Alternatively, use get_node_as with unique names (see [member unique_name_in_owner]).
Note: To find all descendant nodes matching a pattern or a class type, see find_children.
pub fn find_children(&self, pattern: impl AsArg<GString>) -> Array<Gd<Node>>
pub fn find_children(&self, pattern: impl AsArg<GString>) -> Array<Gd<Node>>
To set the default parameters, use find_children_ex and its builder methods. See the book for detailed usage instructions.
Finds all descendants of this node whose names match pattern, returning an empty Array if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.
If type is not empty, only ancestors inheriting from type are included (see is_class).
If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).
If owned is true, only descendants with a valid [member owner] node are checked.
Note: This method can be very slow. Consider storing references to the found nodes in a variable.
Note: To find a single descendant node matching a pattern, see find_child.
pub fn find_children_ex<'ex>(
&'ex self,
pattern: impl AsArg<GString> + 'ex,
) -> ExFindChildren<'ex>
pub fn find_children_ex<'ex>( &'ex self, pattern: impl AsArg<GString> + 'ex, ) -> ExFindChildren<'ex>
Finds all descendants of this node whose names match pattern, returning an empty Array if no match is found. The matching is done against node names, not their paths, through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character.
If type is not empty, only ancestors inheriting from type are included (see is_class).
If recursive is false, only this node’s direct children are checked. Nodes are checked in tree order, so this node’s first direct child is checked first, then its own direct children, etc., before moving to the second direct child, and so on. Internal children are also included in the search (see internal parameter in add_child).
If owned is true, only descendants with a valid [member owner] node are checked.
Note: This method can be very slow. Consider storing references to the found nodes in a variable.
Note: To find a single descendant node matching a pattern, see find_child.
pub fn find_parent(&self, pattern: impl AsArg<GString>) -> Option<Gd<Node>>
pub fn find_parent(&self, pattern: impl AsArg<GString>) -> Option<Gd<Node>>
Finds the first ancestor of this node whose [member name] matches pattern, returning null if no match is found. The matching is done through match_glob. As such, it is case-sensitive, "*" matches zero or more characters, and "?" matches any single character. See also find_child and find_children.
Note: As this method walks upwards in the scene tree, it can be slow in large, deeply nested nodes. Consider storing a reference to the found node in a variable. Alternatively, use get_node_as with unique names (see [member unique_name_in_owner]).
pub fn has_node_and_resource(&self, path: impl AsArg<NodePath>) -> bool
pub fn has_node_and_resource(&self, path: impl AsArg<NodePath>) -> bool
Returns true if path points to a valid node and its subnames point to a valid Resource, e.g. Area2D/CollisionShape2D:shape. Properties that are not Resource types (such as nodes or other Variant types) are not considered. See also get_node_and_resource.
pub fn get_node_and_resource(
&self,
path: impl AsArg<NodePath>,
) -> Array<Variant>
pub fn get_node_and_resource( &self, path: impl AsArg<NodePath>, ) -> Array<Variant>
Fetches a node and its most nested resource as specified by the NodePath’s subname. Returns an Array of size 3 where:
-
Element
0is theNode, ornullif not found; -
Element
1is the subname’s last nestedResource, ornullif not found; -
Element
2is the remainingNodePath, referring to an existing, non-Resourceproperty (seeget_indexed).
Example: Assume that the child’s [member Sprite2D.texture] has been assigned an AtlasTexture:
var a = get_node_and_resource("Area2D/Sprite2D")
print(a[0].name) # Prints Sprite2D
print(a[1]) # Prints <null>
print(a[2]) # Prints ^""
var b = get_node_and_resource("Area2D/Sprite2D:texture:atlas")
print(b[0].name) # Prints Sprite2D
print(b[1].get_class()) # Prints AtlasTexture
print(b[2]) # Prints ^""
var c = get_node_and_resource("Area2D/Sprite2D:texture:atlas:region")
print(c[0].name) # Prints Sprite2D
print(c[1].get_class()) # Prints AtlasTexture
print(c[2]) # Prints ^":region"pub fn is_inside_tree(&self) -> bool
pub fn is_inside_tree(&self) -> bool
pub fn is_part_of_edited_scene(&self) -> bool
pub fn is_part_of_edited_scene(&self) -> bool
Returns true if the node is part of the scene currently opened in the editor.
pub fn is_ancestor_of(&self, node: impl AsArg<Gd<Node>>) -> bool
pub fn is_ancestor_of(&self, node: impl AsArg<Gd<Node>>) -> bool
Returns true if the given node is a direct or indirect child of this node.
pub fn is_greater_than(&self, node: impl AsArg<Gd<Node>>) -> bool
pub fn is_greater_than(&self, node: impl AsArg<Gd<Node>>) -> bool
Returns true if the given node occurs later in the scene hierarchy than this node. A node occurring later is usually processed last.
pub fn get_path(&self) -> NodePath
pub fn get_path(&self) -> NodePath
Returns the node’s absolute path, relative to the [member SceneTree.root]. If the node is not inside the scene tree, this method fails and returns an empty NodePath.
pub fn get_path_to(&self, node: impl AsArg<Gd<Node>>) -> NodePath
pub fn get_path_to(&self, node: impl AsArg<Gd<Node>>) -> NodePath
To set the default parameters, use get_path_to_ex and its builder methods. See the book for detailed usage instructions.
Returns the relative NodePath from this node to the specified node. Both nodes must be in the same SceneTree or scene hierarchy, otherwise this method fails and returns an empty NodePath.
If use_unique_path is true, returns the shortest path accounting for this node’s unique name (see [member unique_name_in_owner]).
Note: If you get a relative path which starts from a unique node, the path may be longer than a normal relative path, due to the addition of the unique node’s name.
pub fn get_path_to_ex<'ex>(
&'ex self,
node: impl AsArg<Gd<Node>> + 'ex,
) -> ExGetPathTo<'ex>
pub fn get_path_to_ex<'ex>( &'ex self, node: impl AsArg<Gd<Node>> + 'ex, ) -> ExGetPathTo<'ex>
Returns the relative NodePath from this node to the specified node. Both nodes must be in the same SceneTree or scene hierarchy, otherwise this method fails and returns an empty NodePath.
If use_unique_path is true, returns the shortest path accounting for this node’s unique name (see [member unique_name_in_owner]).
Note: If you get a relative path which starts from a unique node, the path may be longer than a normal relative path, due to the addition of the unique node’s name.
pub fn add_to_group(&mut self, group: impl AsArg<StringName>)
pub fn add_to_group(&mut self, group: impl AsArg<StringName>)
To set the default parameters, use add_to_group_ex and its builder methods. See the book for detailed usage instructions.
Adds the node to the group. Groups can be helpful to organize a subset of nodes, for example "enemies" or "collectables". See notes in the description, and the group methods in SceneTree.
If persistent is true, the group will be stored when saved inside a PackedScene. All groups created and displayed in the Groups dock are persistent.
Note: To improve performance, the order of group names is not guaranteed and may vary between project runs. Therefore, do not rely on the group order.
Note: SceneTree’s group methods will not work on this node if not inside the tree (see is_inside_tree).
pub fn add_to_group_ex<'ex>(
&'ex mut self,
group: impl AsArg<StringName> + 'ex,
) -> ExAddToGroup<'ex>
pub fn add_to_group_ex<'ex>( &'ex mut self, group: impl AsArg<StringName> + 'ex, ) -> ExAddToGroup<'ex>
Adds the node to the group. Groups can be helpful to organize a subset of nodes, for example "enemies" or "collectables". See notes in the description, and the group methods in SceneTree.
If persistent is true, the group will be stored when saved inside a PackedScene. All groups created and displayed in the Groups dock are persistent.
Note: To improve performance, the order of group names is not guaranteed and may vary between project runs. Therefore, do not rely on the group order.
Note: SceneTree’s group methods will not work on this node if not inside the tree (see is_inside_tree).
pub fn remove_from_group(&mut self, group: impl AsArg<StringName>)
pub fn remove_from_group(&mut self, group: impl AsArg<StringName>)
Removes the node from the given group. Does nothing if the node is not in the group. See also notes in the description, and the SceneTree’s group methods.
pub fn is_in_group(&self, group: impl AsArg<StringName>) -> bool
pub fn is_in_group(&self, group: impl AsArg<StringName>) -> bool
Returns true if this node has been added to the given group. See add_to_group and remove_from_group. See also notes in the description, and the SceneTree’s group methods.
pub fn move_child(&mut self, child_node: impl AsArg<Gd<Node>>, to_index: i32)
pub fn move_child(&mut self, child_node: impl AsArg<Gd<Node>>, to_index: i32)
Moves child_node to the given index. A node’s index is the order among its siblings. If to_index is negative, the index is counted from the end of the list. See also get_child and get_index.
Note: The processing order of several engine callbacks (ready, process, etc.) and notifications sent through propagate_notification is affected by tree order. CanvasItem nodes are also rendered in tree order. See also [member process_priority].
pub fn get_groups(&self) -> Array<StringName>
pub fn get_groups(&self) -> Array<StringName>
Returns an Array of group names that the node has been added to.
Note: To improve performance, the order of group names is not guaranteed and may vary between project runs. Therefore, do not rely on the group order.
Note: This method may also return some group names starting with an underscore (_). These are internally used by the engine. To avoid conflicts, do not use custom groups starting with underscores. To exclude internal groups, see the following code snippet:
# Stores the node's non-internal groups only (as an array of StringNames).
var non_internal_groups = []
for group in get_groups():
if not str(group).begins_with("_"):
non_internal_groups.push_back(group)pub fn set_owner(&mut self, owner: impl AsArg<Option<Gd<Node>>>)
pub fn get_owner(&self) -> Option<Gd<Node>>
pub fn get_index(&self) -> i32
pub fn get_index(&self) -> i32
To set the default parameters, use get_index_ex and its builder methods. See the book for detailed usage instructions.
Returns this node’s order among its siblings. The first node’s index is 0. See also get_child.
If include_internal is false, returns the index ignoring internal children. The first, non-internal child will have an index of 0 (see add_child’s internal parameter).
pub fn get_index_ex<'ex>(&'ex self) -> ExGetIndex<'ex>
pub fn get_index_ex<'ex>(&'ex self) -> ExGetIndex<'ex>
pub fn print_tree(&mut self)
pub fn print_tree(&mut self)
Prints the node and its children to the console, recursively. The node does not have to be inside the tree. This method outputs NodePaths relative to this node, and is good for copy/pasting into get_node_as. See also print_tree_pretty.
May print, for example:
.
Menu
Menu/Label
Menu/Camera2D
SplashScreen
SplashScreen/Camera2Dpub fn print_tree_pretty(&mut self)
pub fn print_tree_pretty(&mut self)
Prints the node and its children to the console, recursively. The node does not have to be inside the tree. Similar to print_tree, but the graphical representation looks like what is displayed in the editor’s Scene dock. It is useful for inspecting larger trees.
May print, for example:
┖╴TheGame
┠╴Menu
┃ ┠╴Label
┃ ┖╴Camera2D
┖╴SplashScreen
┖╴Camera2Dpub fn get_tree_string(&self) -> GString
pub fn get_tree_string(&self) -> GString
Returns the tree as a String. Used mainly for debugging purposes. This version displays the path relative to the current node, and is good for copy/pasting into the get_node_as function. It also can be used in game UI/UX.
May print, for example:
TheGame
TheGame/Menu
TheGame/Menu/Label
TheGame/Menu/Camera2D
TheGame/SplashScreen
TheGame/SplashScreen/Camera2Dpub fn get_tree_string_pretty(&self) -> GString
pub fn get_tree_string_pretty(&self) -> GString
Similar to get_tree_string, this returns the tree as a String. This version displays a more graphical representation similar to what is displayed in the Scene Dock. It is useful for inspecting larger trees.
May print, for example:
┖╴TheGame
┠╴Menu
┃ ┠╴Label
┃ ┖╴Camera2D
┖╴SplashScreen
┖╴Camera2Dpub fn set_scene_file_path(&mut self, scene_file_path: impl AsArg<GString>)
pub fn get_scene_file_path(&self) -> GString
pub fn propagate_notification(&mut self, what: i32)
pub fn propagate_notification(&mut self, what: i32)
Calls notify with what on this node and all of its children, recursively.
pub fn propagate_call(&mut self, method: impl AsArg<StringName>)
pub fn propagate_call(&mut self, method: impl AsArg<StringName>)
To set the default parameters, use propagate_call_ex and its builder methods. See the book for detailed usage instructions.
Calls the given method name, passing args as arguments, on this node and all of its children, recursively.
If parent_first is true, the method is called on this node first, then on all of its children. If false, the children’s methods are called first.
pub fn propagate_call_ex<'ex>(
&'ex mut self,
method: impl AsArg<StringName> + 'ex,
) -> ExPropagateCall<'ex>
pub fn propagate_call_ex<'ex>( &'ex mut self, method: impl AsArg<StringName> + 'ex, ) -> ExPropagateCall<'ex>
Calls the given method name, passing args as arguments, on this node and all of its children, recursively.
If parent_first is true, the method is called on this node first, then on all of its children. If false, the children’s methods are called first.
pub fn set_physics_process(&mut self, enable: bool)
pub fn set_physics_process(&mut self, enable: bool)
If set to true, enables physics (fixed framerate) processing. When a node is being processed, it will receive a NodeNotification::PHYSICS_PROCESS at a fixed (usually 60 FPS, see [member Engine.physics_ticks_per_second] to change) interval (and the physics_process callback will be called if it exists).
Note: If physics_process is overridden, this will be automatically enabled before ready is called.
pub fn get_physics_process_delta_time(&self) -> f64
pub fn get_physics_process_delta_time(&self) -> f64
Returns the time elapsed (in seconds) since the last physics callback. This value is identical to physics_process’s delta parameter, and is often consistent at run-time, unless [member Engine.physics_ticks_per_second] is changed. See also NodeNotification::PHYSICS_PROCESS.
Note: The returned value will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid “spiral of death” scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both process and physics_process. As a result, avoid using delta for time measurements in real-world seconds. Use the Time singleton’s methods for this purpose instead, such as get_ticks_usec.
pub fn is_physics_processing(&self) -> bool
pub fn is_physics_processing(&self) -> bool
Returns true if physics processing is enabled (see set_physics_process).
pub fn get_process_delta_time(&self) -> f64
pub fn get_process_delta_time(&self) -> f64
Returns the time elapsed (in seconds) since the last process callback. This value is identical to process’s delta parameter, and may vary from frame to frame. See also NodeNotification::PROCESS.
Note: The returned value will be larger than expected if running at a framerate lower than [member Engine.physics_ticks_per_second] / [member Engine.max_physics_steps_per_frame] FPS. This is done to avoid “spiral of death” scenarios where performance would plummet due to an ever-increasing number of physics steps per frame. This behavior affects both process and physics_process. As a result, avoid using delta for time measurements in real-world seconds. Use the Time singleton’s methods for this purpose instead, such as get_ticks_usec.
pub fn set_process(&mut self, enable: bool)
pub fn set_process(&mut self, enable: bool)
If set to true, enables processing. When a node is being processed, it will receive a NodeNotification::PROCESS on every drawn frame (and the process callback will be called if it exists).
Note: If process is overridden, this will be automatically enabled before ready is called.
Note: This method only affects the process callback, i.e. it has no effect on other callbacks like physics_process. If you want to disable all processing for the node, set [member process_mode] to ProcessMode::DISABLED.
pub fn set_process_priority(&mut self, priority: i32)
pub fn get_process_priority(&self) -> i32
pub fn set_physics_process_priority(&mut self, priority: i32)
pub fn get_physics_process_priority(&self) -> i32
pub fn is_processing(&self) -> bool
pub fn is_processing(&self) -> bool
Returns true if processing is enabled (see set_process).
pub fn set_process_input(&mut self, enable: bool)
pub fn set_process_input(&mut self, enable: bool)
pub fn is_processing_input(&self) -> bool
pub fn is_processing_input(&self) -> bool
Returns true if the node is processing input (see set_process_input).
pub fn set_process_shortcut_input(&mut self, enable: bool)
pub fn set_process_shortcut_input(&mut self, enable: bool)
If set to true, enables shortcut processing for this node.
Note: If shortcut_input is overridden, this will be automatically enabled before ready is called.
pub fn is_processing_shortcut_input(&self) -> bool
pub fn is_processing_shortcut_input(&self) -> bool
Returns true if the node is processing shortcuts (see set_process_shortcut_input).
pub fn set_process_unhandled_input(&mut self, enable: bool)
pub fn set_process_unhandled_input(&mut self, enable: bool)
If set to true, enables unhandled input processing. It enables the node to receive all input that was not previously handled (usually by a Control).
Note: If unhandled_input is overridden, this will be automatically enabled before ready is called. Unhandled input processing is also already enabled for GUI controls, such as Button and TextEdit.
pub fn is_processing_unhandled_input(&self) -> bool
pub fn is_processing_unhandled_input(&self) -> bool
Returns true if the node is processing unhandled input (see set_process_unhandled_input).
pub fn set_process_unhandled_key_input(&mut self, enable: bool)
pub fn set_process_unhandled_key_input(&mut self, enable: bool)
If set to true, enables unhandled key input processing.
Note: If unhandled_key_input is overridden, this will be automatically enabled before ready is called.
pub fn is_processing_unhandled_key_input(&self) -> bool
pub fn is_processing_unhandled_key_input(&self) -> bool
Returns true if the node is processing unhandled key input (see set_process_unhandled_key_input).
pub fn set_process_mode(&mut self, mode: ProcessMode)
pub fn get_process_mode(&self) -> ProcessMode
pub fn can_process(&self) -> bool
pub fn can_process(&self) -> bool
Returns true if the node can receive processing notifications and input callbacks (NodeNotification::PROCESS, input, etc.) from the SceneTree and Viewport. The returned value depends on [member process_mode]:
-
If set to
ProcessMode::PAUSABLE, returnstruewhen the game is processing, i.e. [member SceneTree.paused] isfalse; -
If set to
ProcessMode::WHEN_PAUSED, returnstruewhen the game is paused, i.e. [member SceneTree.paused] istrue; -
If set to
ProcessMode::ALWAYS, always returnstrue; -
If set to
ProcessMode::DISABLED, always returnsfalse; -
If set to
ProcessMode::INHERIT, use the parent node’s [member process_mode] to determine the result.
If the node is not inside the tree, returns false no matter the value of [member process_mode].
pub fn set_process_thread_group(&mut self, mode: ProcessThreadGroup)
pub fn get_process_thread_group(&self) -> ProcessThreadGroup
pub fn set_process_thread_messages(&mut self, flags: ProcessThreadMessages)
pub fn get_process_thread_messages(&self) -> ProcessThreadMessages
pub fn set_process_thread_group_order(&mut self, order: i32)
pub fn get_process_thread_group_order(&self) -> i32
pub fn queue_accessibility_update(&mut self)
pub fn queue_accessibility_update(&mut self)
Queues an accessibility information update for this node.
pub fn get_accessibility_element(&self) -> Rid
pub fn get_accessibility_element(&self) -> Rid
Returns main accessibility element RID.
Note: This method should be called only during accessibility information updates (NodeNotification::ACCESSIBILITY_UPDATE).
pub fn set_display_folded(&mut self, fold: bool)
pub fn set_display_folded(&mut self, fold: bool)
If set to true, the node appears folded in the Scene dock. As a result, all of its children are hidden. This method is intended to be used in editor plugins and tools, but it also works in release builds. See also is_displayed_folded.
pub fn is_displayed_folded(&self) -> bool
pub fn is_displayed_folded(&self) -> bool
Returns true if the node is folded (collapsed) in the Scene dock. This method is intended to be used in editor plugins and tools. See also set_display_folded.
pub fn set_process_internal(&mut self, enable: bool)
pub fn set_process_internal(&mut self, enable: bool)
If set to true, enables internal processing for this node. Internal processing happens in isolation from the normal process calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or processing is disabled for scripting (set_process).
Warning: Built-in nodes rely on internal processing for their internal logic. Disabling it is unsafe and may lead to unexpected behavior. Use this method if you know what you are doing.
pub fn is_processing_internal(&self) -> bool
pub fn is_processing_internal(&self) -> bool
Returns true if internal processing is enabled (see set_process_internal).
pub fn set_physics_process_internal(&mut self, enable: bool)
pub fn set_physics_process_internal(&mut self, enable: bool)
If set to true, enables internal physics for this node. Internal physics processing happens in isolation from the normal physics_process calls and is used by some nodes internally to guarantee proper functioning even if the node is paused or physics processing is disabled for scripting (set_physics_process).
Warning: Built-in nodes rely on internal processing for their internal logic. Disabling it is unsafe and may lead to unexpected behavior. Use this method if you know what you are doing.
pub fn is_physics_processing_internal(&self) -> bool
pub fn is_physics_processing_internal(&self) -> bool
Returns true if internal physics processing is enabled (see set_physics_process_internal).
pub fn set_physics_interpolation_mode(&mut self, mode: PhysicsInterpolationMode)
pub fn get_physics_interpolation_mode(&self) -> PhysicsInterpolationMode
pub fn is_physics_interpolated(&self) -> bool
pub fn is_physics_interpolated(&self) -> bool
Returns true if physics interpolation is enabled for this node (see [member physics_interpolation_mode]).
Note: Interpolation will only be active if both the flag is set and physics interpolation is enabled within the SceneTree. This can be tested using is_physics_interpolated_and_enabled.
pub fn is_physics_interpolated_and_enabled(&self) -> bool
pub fn is_physics_interpolated_and_enabled(&self) -> bool
Returns true if physics interpolation is enabled (see [member physics_interpolation_mode]) and enabled in the SceneTree.
This is a convenience version of is_physics_interpolated that also checks whether physics interpolation is enabled globally.
See [member SceneTree.physics_interpolation] and [member ProjectSettings.physics/common/physics_interpolation].
pub fn reset_physics_interpolation(&mut self)
pub fn reset_physics_interpolation(&mut self)
When physics interpolation is active, moving a node to a radically different transform (such as placement within a level) can result in a visible glitch as the object is rendered moving from the old to new position over the physics tick.
That glitch can be prevented by calling this method, which temporarily disables interpolation until the physics tick is complete.
The notification NodeNotification::RESET_PHYSICS_INTERPOLATION will be received by the node and all children recursively.
Note: This function should be called after moving the node, rather than before.
pub fn set_auto_translate_mode(&mut self, mode: AutoTranslateMode)
pub fn get_auto_translate_mode(&self) -> AutoTranslateMode
pub fn can_auto_translate(&self) -> bool
pub fn can_auto_translate(&self) -> bool
pub fn set_translation_domain_inherited(&mut self)
pub fn set_translation_domain_inherited(&mut self)
Makes this node inherit the translation domain from its parent node. If this node has no parent, the main translation domain will be used.
This is the default behavior for all nodes. Calling set_translation_domain disables this behavior.
pub fn get_window(&self) -> Option<Gd<Window>>
pub fn get_window(&self) -> Option<Gd<Window>>
Returns the Window that contains this node. If the node is in the main window, this is equivalent to getting the root node (get_tree().get_root()).
pub fn get_last_exclusive_window(&self) -> Option<Gd<Window>>
pub fn get_last_exclusive_window(&self) -> Option<Gd<Window>>
Returns the Window that contains this node, or the last exclusive child in a chain of windows starting with the one that contains this node.
pub fn create_tween(&mut self) -> Gd<Tween>
pub fn create_tween(&mut self) -> Gd<Tween>
Creates a new Tween and binds it to this node.
This is the equivalent of doing:
get_tree().create_tween().bind_node(self)The Tween will start automatically on the next process frame or physics frame (depending on [enum Tween.TweenProcessMode]). See bind_node for more info on Tweens bound to nodes.
Note: The method can still be used when the node is not inside SceneTree. It can fail in an unlikely case of using a custom MainLoop.
pub fn duplicate(&self) -> Option<Gd<Node>>
👎Deprecated: Use Gd::duplicate_node() or Gd::duplicate_node_ex().
pub fn duplicate(&self) -> Option<Gd<Node>>
Use Gd::duplicate_node() or Gd::duplicate_node_ex().
To set the default parameters, use duplicate_ex and its builder methods. See the book for detailed usage instructions.
Duplicates the node, returning a new node with all of its properties, signals, groups, and children copied from the original, recursively. The behavior can be tweaked through the flags (see [enum DuplicateFlags]). Internal nodes are not duplicated.
Note: For nodes with a Script attached, if init has been defined with required parameters, the duplicated node will not have a Script.
Note: By default, this method will duplicate only properties marked for serialization (i.e. using @GlobalScope.PROPERTY_USAGE_STORAGE, or in GDScript, @GDScript.@export). If you want to duplicate all properties, use DuplicateFlags::INTERNAL_STATE.
pub fn duplicate_ex<'ex>(&'ex self) -> ExDuplicate<'ex>
👎Deprecated: Use Gd::duplicate_node() or Gd::duplicate_node_ex().
pub fn duplicate_ex<'ex>(&'ex self) -> ExDuplicate<'ex>
Use Gd::duplicate_node() or Gd::duplicate_node_ex().
Duplicates the node, returning a new node with all of its properties, signals, groups, and children copied from the original, recursively. The behavior can be tweaked through the flags (see [enum DuplicateFlags]). Internal nodes are not duplicated.
Note: For nodes with a Script attached, if init has been defined with required parameters, the duplicated node will not have a Script.
Note: By default, this method will duplicate only properties marked for serialization (i.e. using @GlobalScope.PROPERTY_USAGE_STORAGE, or in GDScript, @GDScript.@export). If you want to duplicate all properties, use DuplicateFlags::INTERNAL_STATE.
pub fn replace_by(&mut self, node: impl AsArg<Gd<Node>>)
pub fn replace_by(&mut self, node: impl AsArg<Gd<Node>>)
To set the default parameters, use replace_by_ex and its builder methods. See the book for detailed usage instructions.
Replaces this node by the given node. All children of this node are moved to node.
If keep_groups is true, the node is added to the same groups that the replaced node is in (see add_to_group).
Warning: The replaced node is removed from the tree, but it is not deleted. To prevent memory leaks, store a reference to the node in a variable, or use free.
pub fn replace_by_ex<'ex>(
&'ex mut self,
node: impl AsArg<Gd<Node>> + 'ex,
) -> ExReplaceBy<'ex>
pub fn replace_by_ex<'ex>( &'ex mut self, node: impl AsArg<Gd<Node>> + 'ex, ) -> ExReplaceBy<'ex>
Replaces this node by the given node. All children of this node are moved to node.
If keep_groups is true, the node is added to the same groups that the replaced node is in (see add_to_group).
Warning: The replaced node is removed from the tree, but it is not deleted. To prevent memory leaks, store a reference to the node in a variable, or use free.
pub fn set_scene_instance_load_placeholder(&mut self, load_placeholder: bool)
pub fn set_scene_instance_load_placeholder(&mut self, load_placeholder: bool)
If set to true, the node becomes an InstancePlaceholder when packed and instantiated from a PackedScene. See also get_scene_instance_load_placeholder.
pub fn get_scene_instance_load_placeholder(&self) -> bool
pub fn get_scene_instance_load_placeholder(&self) -> bool
Returns true if this node is an instance load placeholder. See InstancePlaceholder and set_scene_instance_load_placeholder.
pub fn set_editable_instance(
&mut self,
node: impl AsArg<Gd<Node>>,
is_editable: bool,
)
pub fn set_editable_instance( &mut self, node: impl AsArg<Gd<Node>>, is_editable: bool, )
Set to true to allow all nodes owned by node to be available, and editable, in the Scene dock, even if their [member owner] is not the scene root. This method is intended to be used in editor plugins and tools, but it also works in release builds. See also is_editable_instance.
pub fn is_editable_instance(&self, node: impl AsArg<Option<Gd<Node>>>) -> bool
pub fn is_editable_instance(&self, node: impl AsArg<Option<Gd<Node>>>) -> bool
Returns true if node has editable children enabled relative to this node. This method is intended to be used in editor plugins and tools. See also set_editable_instance.
pub fn get_viewport(&self) -> Option<Gd<Viewport>>
pub fn get_viewport(&self) -> Option<Gd<Viewport>>
Returns the node’s closest Viewport ancestor, if the node is inside the tree. Otherwise, returns null.
pub fn queue_free(&mut self)
pub fn queue_free(&mut self)
Queues this node to be deleted at the end of the current frame. When deleted, all of its children are deleted as well, and all references to the node and its children become invalid.
Unlike with free, the node is not deleted instantly, and it can still be accessed before deletion. It is also safe to call queue_free multiple times. Use is_queued_for_deletion to check if the node will be deleted at the end of the frame.
Note: The node will only be freed after all other deferred calls are finished. Using this method is not always the same as calling free through call_deferred.
pub fn request_ready(&mut self)
pub fn request_ready(&mut self)
Requests ready to be called again the next time the node enters the tree. Does not immediately call ready.
Note: This method only affects the current node. If the node’s children also need to request ready, this method needs to be called for each one of them. When the node and its children enter the tree again, the order of ready callbacks will be the same as normal.
pub fn is_node_ready(&self) -> bool
pub fn is_node_ready(&self) -> bool
Returns true if the node is ready, i.e. it’s inside scene tree and all its children are initialized.
request_ready resets it back to false.
To set the default parameters, use set_multiplayer_authority_ex and its builder methods. See the book for detailed usage instructions.
Sets the node’s multiplayer authority to the peer with the given peer id. The multiplayer authority is the peer that has authority over the node on the network. Defaults to peer ID 1 (the server). Useful in conjunction with rpc_config and the MultiplayerAPI.
If recursive is true, the given peer is recursively set as the authority for all children of this node.
Warning: This does not automatically replicate the new authority to other peers. It is the developer’s responsibility to do so. You may replicate the new authority’s information using [member MultiplayerSpawner.spawn_function], an RPC, or a MultiplayerSynchronizer. Furthermore, the parent’s authority does not propagate to newly added children.
Sets the node’s multiplayer authority to the peer with the given peer id. The multiplayer authority is the peer that has authority over the node on the network. Defaults to peer ID 1 (the server). Useful in conjunction with rpc_config and the MultiplayerAPI.
If recursive is true, the given peer is recursively set as the authority for all children of this node.
Warning: This does not automatically replicate the new authority to other peers. It is the developer’s responsibility to do so. You may replicate the new authority’s information using [member MultiplayerSpawner.spawn_function], an RPC, or a MultiplayerSynchronizer. Furthermore, the parent’s authority does not propagate to newly added children.
Returns the peer ID of the multiplayer authority for this node. See set_multiplayer_authority.
Returns true if the local system is the multiplayer authority of this node.
pub fn get_multiplayer(&self) -> Option<Gd<MultiplayerApi>>
pub fn rpc_config(&mut self, method: impl AsArg<StringName>, config: &Variant)
pub fn rpc_config(&mut self, method: impl AsArg<StringName>, config: &Variant)
Changes the RPC configuration for the given method. config should either be null to disable the feature (as by default), or a Dictionary containing the following entries:
-
rpc_mode: see [enum MultiplayerAPI.RPCMode]; -
transfer_mode: see [enum MultiplayerPeer.TransferMode]; -
call_local: iftrue, the method will also be called locally; -
channel: anintrepresenting the channel to send the RPC on.
Note: In GDScript, this method corresponds to the @GDScript.@rpc annotation, with various parameters passed (@rpc(any), @rpc(authority)…). See also the high-level multiplayer tutorial.
pub fn get_node_rpc_config(&self) -> Variant
pub fn get_node_rpc_config(&self) -> Variant
Returns a Dictionary mapping method names to their RPC configuration defined for this node using rpc_config.
Note: This method only returns the RPC configuration assigned via rpc_config. See get_rpc_config to retrieve the RPCs defined by the Script.
pub fn set_editor_description( &mut self, editor_description: impl AsArg<GString>, )
pub fn get_editor_description(&self) -> GString
pub fn set_unique_name_in_owner(&mut self, enable: bool)
pub fn is_unique_name_in_owner(&self) -> bool
pub fn atr(&self, message: impl AsArg<GString>) -> GString
pub fn atr(&self, message: impl AsArg<GString>) -> GString
To set the default parameters, use atr_ex and its builder methods. See the book for detailed usage instructions.
Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
This method works the same as tr, with the addition of respecting the [member auto_translate_mode] state.
If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.
For detailed examples, see Internationalizing games.
pub fn atr_ex<'ex>(&'ex self, message: impl AsArg<GString> + 'ex) -> ExAtr<'ex>
pub fn atr_ex<'ex>(&'ex self, message: impl AsArg<GString> + 'ex) -> ExAtr<'ex>
Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
This method works the same as tr, with the addition of respecting the [member auto_translate_mode] state.
If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.
For detailed examples, see Internationalizing games.
pub fn atr_n(
&self,
message: impl AsArg<GString>,
plural_message: impl AsArg<StringName>,
n: i32,
) -> GString
pub fn atr_n( &self, message: impl AsArg<GString>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString
To set the default parameters, use atr_n_ex and its builder methods. See the book for detailed usage instructions.
Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.
This method works the same as tr_n, with the addition of respecting the [member auto_translate_mode] state.
If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.
The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.
For detailed examples, see Localization using gettext.
Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with atr.
pub fn atr_n_ex<'ex>(
&'ex self,
message: impl AsArg<GString> + 'ex,
plural_message: impl AsArg<StringName> + 'ex,
n: i32,
) -> ExAtrN<'ex>
pub fn atr_n_ex<'ex>( &'ex self, message: impl AsArg<GString> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExAtrN<'ex>
Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.
This method works the same as tr_n, with the addition of respecting the [member auto_translate_mode] state.
If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.
The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.
For detailed examples, see Localization using gettext.
Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with atr.
pub fn rpc(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Error
pub fn rpc( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Error
Sends a remote procedure call request for the given method to peers on the network (and locally), sending additional arguments to the method called by the RPC. The call request will only be received by nodes with the same NodePath, including the exact same [member name]. Behavior depends on the RPC configuration for the given method (see rpc_config and @GDScript.@rpc). By default, methods are not exposed to RPCs.
May return Error::OK if the call is successful, Error::ERR_INVALID_PARAMETER if the arguments passed in the method do not match, Error::ERR_UNCONFIGURED if the node’s [member multiplayer] cannot be fetched (such as when the node is not inside the tree), Error::ERR_CONNECTION_ERROR if [member multiplayer]’s connection is not available.
Note: You can only safely use RPCs on clients after you received the MultiplayerAPI.connected_to_server signal from the MultiplayerAPI. You also need to keep track of the connection state, either by the MultiplayerAPI signals like MultiplayerAPI.server_disconnected or by checking (get_multiplayer().peer.get_connection_status() == CONNECTION_CONNECTED).
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_rpc(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Error, CallError>
pub fn try_rpc( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn rpc_id(
&mut self,
peer_id: i64,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Error
pub fn rpc_id( &mut self, peer_id: i64, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Error
Sends a rpc to a specific peer identified by peer_id (see set_target_peer).
May return Error::OK if the call is successful, Error::ERR_INVALID_PARAMETER if the arguments passed in the method do not match, Error::ERR_UNCONFIGURED if the node’s [member multiplayer] cannot be fetched (such as when the node is not inside the tree), Error::ERR_CONNECTION_ERROR if [member multiplayer]’s connection is not available.
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_rpc_id(
&mut self,
peer_id: i64,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Error, CallError>
pub fn try_rpc_id( &mut self, peer_id: i64, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn update_configuration_warnings(&mut self)
pub fn update_configuration_warnings(&mut self)
Refreshes the warnings displayed for this node in the Scene dock. Use get_configuration_warnings to customize the warning messages to display.
pub fn call_deferred_thread_group(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Variant
pub fn call_deferred_thread_group( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant
This function is similar to call_deferred except that the call will take place when the node thread group is processed. If the node thread group processes in sub-threads, then the call will be done on that thread, right before NodeNotification::PROCESS or NodeNotification::PHYSICS_PROCESS, the process or physics_process or their internal versions are called.
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_call_deferred_thread_group(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Variant, CallError>
pub fn try_call_deferred_thread_group( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn set_deferred_thread_group(
&mut self,
property: impl AsArg<StringName>,
value: &Variant,
)
pub fn set_deferred_thread_group( &mut self, property: impl AsArg<StringName>, value: &Variant, )
Similar to call_deferred_thread_group, but for setting properties.
pub fn notify_deferred_thread_group(&mut self, what: i32)
pub fn notify_deferred_thread_group(&mut self, what: i32)
Similar to call_deferred_thread_group, but for notifications.
pub fn call_thread_safe(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Variant
pub fn call_thread_safe( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant
This function ensures that the calling of this function will succeed, no matter whether it’s being done from a thread or not. If called from a thread that is not allowed to call the function, the call will become deferred. Otherwise, the call will go through directly.
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_call_thread_safe(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Variant, CallError>
pub fn try_call_thread_safe( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn set_thread_safe(
&mut self,
property: impl AsArg<StringName>,
value: &Variant,
)
pub fn set_thread_safe( &mut self, property: impl AsArg<StringName>, value: &Variant, )
Similar to call_thread_safe, but for setting properties.
pub fn notify_thread_safe(&mut self, what: i32)
pub fn notify_thread_safe(&mut self, what: i32)
Similar to call_thread_safe, but for notifications.
pub fn notify(&mut self, what: NodeNotification)
pub fn notify(&mut self, what: NodeNotification)
⚠️ Sends a Godot notification to all classes inherited by the object.
Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().
Starts from the highest ancestor (the Object class) and goes down the hierarchy.
See also Godot docs for Object::notification().
§Panics
If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter
a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must
be exclusive.
pub fn notify_reversed(&mut self, what: NodeNotification)
pub fn notify_reversed(&mut self, what: NodeNotification)
⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.
See docs of that method, including the panics.
Methods from Deref<Target = Object>§
pub fn get_script(&self) -> Option<Gd<Script>>
pub fn set_script(&mut self, script: impl AsArg<Option<Gd<Script>>>)
pub fn connect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, ) -> Error
pub fn connect_flags( &mut self, signal: impl AsArg<StringName>, callable: &Callable, flags: ConnectFlags, ) -> Error
pub fn is_class(&self, class: impl AsArg<GString>) -> bool
pub fn is_class(&self, class: impl AsArg<GString>) -> bool
Returns true if the object inherits from the given class. See also get_class.
var sprite2d = Sprite2D.new()
sprite2d.is_class("Sprite2D") # Returns true
sprite2d.is_class("Node") # Returns true
sprite2d.is_class("Node3D") # Returns falseNote: This method ignores class_name declarations in the object’s script.
pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)
pub fn set(&mut self, property: impl AsArg<StringName>, value: &Variant)
Assigns value to the given property. If the property does not exist or the given value’s type doesn’t match, nothing happens.
var node = Node2D.new()
node.set("global_scale", Vector2(8, 2.5))
print(node.global_scale) # Prints (8.0, 2.5)Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
pub fn get(&self, property: impl AsArg<StringName>) -> Variant
pub fn get(&self, property: impl AsArg<StringName>) -> Variant
Returns the Variant value of the given property. If the property does not exist, this method returns null.
var node = Node2D.new()
node.rotation = 1.5
var a = node.get("rotation") # a is 1.5Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
pub fn set_indexed(
&mut self,
property_path: impl AsArg<NodePath>,
value: &Variant,
)
pub fn set_indexed( &mut self, property_path: impl AsArg<NodePath>, value: &Variant, )
Assigns a new value to the property identified by the property_path. The path should be a NodePath relative to this object, and can use the colon character (:) to access nested properties.
var node = Node2D.new()
node.set_indexed("position", Vector2(42, 0))
node.set_indexed("position:y", -10)
print(node.position) # Prints (42.0, -10.0)Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant
pub fn get_indexed(&self, property_path: impl AsArg<NodePath>) -> Variant
Gets the object’s property indexed by the given property_path. The path should be a NodePath relative to the current object and can use the colon character (:) to access nested properties.
Examples: "position:x" or "material:next_pass:blend_mode".
var node = Node2D.new()
node.position = Vector2(5, -10)
var a = node.get_indexed("position") # a is Vector2(5, -10)
var b = node.get_indexed("position:y") # b is -10Note: In C#, property_path must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
Note: This method does not support actual paths to nodes in the SceneTree, only sub-property paths. In the context of nodes, use get_node_and_resource instead.
pub fn get_property_list(&self) -> Array<Dictionary<Variant, Variant>>
pub fn get_property_list(&self) -> Array<Dictionary<Variant, Variant>>
Returns the object’s property list as an Array of dictionaries. Each Dictionary contains the following entries:
-
nameis the property’s name, as aString; -
class_nameis an emptyStringName, unless the property isVariantType::OBJECTand it inherits from a class; -
typeis the property’s type, as anint(see [enum Variant.Type]); -
hintis how the property is meant to be edited (see [enum PropertyHint]); -
hint_stringdepends on the hint (see [enum PropertyHint]); -
usageis a combination of [enum PropertyUsageFlags].
Note: In GDScript, all class members are treated as properties. In C# and GDExtension, it may be necessary to explicitly mark class members as Godot properties using decorators or attributes.
pub fn get_method_list(&self) -> Array<Dictionary<Variant, Variant>>
pub fn get_method_list(&self) -> Array<Dictionary<Variant, Variant>>
Returns this object’s methods and their signatures as an Array of dictionaries. Each Dictionary contains the following entries:
-
nameis the name of the method, as aString; -
argsis anArrayof dictionaries representing the arguments; -
default_argsis the default arguments as anArrayof variants; -
flagsis a combination of [enum MethodFlags]; -
idis the method’s internal identifierint; -
returnis the returned value, as aDictionary;
Note: The dictionaries of args and return are formatted identically to the results of get_property_list, although not all entries are used.
pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool
pub fn property_can_revert(&self, property: impl AsArg<StringName>) -> bool
Returns true if the given property has a custom default value. Use property_get_revert to get the property’s default value.
Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_can_revert] to customize the default value. If [method _property_can_revert] is not implemented, this method returns false.
pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant
pub fn property_get_revert(&self, property: impl AsArg<StringName>) -> Variant
Returns the custom default value of the given property. Use property_can_revert to check if the property has a custom default value.
Note: This method is used by the Inspector dock to display a revert icon. The object must implement [method _property_get_revert] to customize the default value. If [method _property_get_revert] is not implemented, this method returns null.
pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)
pub fn set_meta(&mut self, name: impl AsArg<StringName>, value: &Variant)
Adds or changes the entry name inside the object’s metadata. The metadata value can be any Variant, although some types cannot be serialized correctly.
If value is null, the entry is removed. This is the equivalent of using remove_meta. See also has_meta and get_meta.
Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.
Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
pub fn remove_meta(&mut self, name: impl AsArg<StringName>)
pub fn remove_meta(&mut self, name: impl AsArg<StringName>)
Removes the given entry name from the object’s metadata. See also has_meta, get_meta and set_meta.
Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.
Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant
pub fn get_meta(&self, name: impl AsArg<StringName>) -> Variant
To set the default parameters, use get_meta_ex and its builder methods. See the book for detailed usage instructions.
Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.
Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.
Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
pub fn get_meta_ex<'ex>(
&'ex self,
name: impl AsArg<StringName> + 'ex,
) -> ExGetMeta<'ex>
pub fn get_meta_ex<'ex>( &'ex self, name: impl AsArg<StringName> + 'ex, ) -> ExGetMeta<'ex>
Returns the object’s metadata value for the given entry name. If the entry does not exist, returns default. If default is null, an error is also generated.
Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.
Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool
pub fn has_meta(&self, name: impl AsArg<StringName>) -> bool
Returns true if a metadata entry is found with the given name. See also get_meta, set_meta and remove_meta.
Note: A metadata’s name must be a valid identifier as per is_valid_identifier method.
Note: Metadata that has a name starting with an underscore (_) is considered editor-only. Editor-only metadata is not displayed in the Inspector and should not be edited, although it can still be found by this method.
pub fn get_meta_list(&self) -> Array<StringName>
pub fn get_meta_list(&self) -> Array<StringName>
Returns the object’s metadata entry names as an Array of StringNames.
pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)
pub fn add_user_signal(&mut self, signal: impl AsArg<GString>)
To set the default parameters, use add_user_signal_ex and its builder methods. See the book for detailed usage instructions.
Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.
add_user_signal("hurt", [
{ "name": "damage", "type": TYPE_INT },
{ "name": "source", "type": TYPE_OBJECT }
])pub fn add_user_signal_ex<'ex>(
&'ex mut self,
signal: impl AsArg<GString> + 'ex,
) -> ExAddUserSignal<'ex>
pub fn add_user_signal_ex<'ex>( &'ex mut self, signal: impl AsArg<GString> + 'ex, ) -> ExAddUserSignal<'ex>
Adds a user-defined signal named signal. Optional arguments for the signal can be added as an Array of dictionaries, each defining a name String and a type int (see [enum Variant.Type]). See also has_user_signal and remove_user_signal.
add_user_signal("hurt", [
{ "name": "damage", "type": TYPE_INT },
{ "name": "source", "type": TYPE_OBJECT }
])pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool
pub fn has_user_signal(&self, signal: impl AsArg<StringName>) -> bool
Returns true if the given user-defined signal name exists. Only signals added with add_user_signal are included. See also remove_user_signal.
pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)
pub fn remove_user_signal(&mut self, signal: impl AsArg<StringName>)
Removes the given user signal signal from the object. See also add_user_signal and has_user_signal.
pub fn emit_signal(
&mut self,
signal: impl AsArg<StringName>,
varargs: &[Variant],
) -> Error
pub fn emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Error
Emits the given signal by name. The signal must exist, so it should be a built-in signal of this class or one of its inherited classes, or a user-defined signal (see add_user_signal). This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
Returns Error::ERR_UNAVAILABLE if signal does not exist or the parameters are invalid.
emit_signal("hit", "sword", 100)
emit_signal("game_over")Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_emit_signal(
&mut self,
signal: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Error, CallError>
pub fn try_emit_signal( &mut self, signal: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Error, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn call(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Variant
pub fn call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant
Calls the method on the object and returns the result. This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
var node = Node3D.new()
node.call("rotate", Vector3(1.0, 0.0, 0.0), 1.571)Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.
§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_call(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Variant, CallError>
pub fn try_call( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn call_deferred(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Variant
pub fn call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Variant
Calls the method on the object during idle time. Always returns null, not the method’s result.
Idle time happens mainly at the end of process and physics frames. In it, deferred calls will be run until there are none left, which means you can defer calls from other deferred calls and they’ll still be run in the current idle time cycle. This means you should not call a method deferred from itself (or from a method called by it), as this causes infinite recursion the same way as if you had called the method directly.
This method supports a variable number of arguments, so parameters can be passed as a comma separated list.
var node = Node3D.new()
node.call_deferred("rotate", Vector3(1.0, 0.0, 0.0), 1.571)For methods that are deferred from the same thread, the order of execution at idle time is identical to the order in which call_deferred was called.
See also call_deferred.
Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.
Note: If you’re looking to delay the function call by a frame, refer to the SceneTree.process_frame and SceneTree.physics_frame signals.
var node = Node3D.new()
# Make a Callable and bind the arguments to the node's rotate() call.
var callable = node.rotate.bind(Vector3(1.0, 0.0, 0.0), 1.571)
# Connect the callable to the process_frame signal, so it gets called in the next process frame.
# CONNECT_ONE_SHOT makes sure it only gets called once instead of every frame.
get_tree().process_frame.connect(callable, CONNECT_ONE_SHOT)§Panics
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will panic in such a case.
pub fn try_call_deferred(
&mut self,
method: impl AsArg<StringName>,
varargs: &[Variant],
) -> Result<Variant, CallError>
pub fn try_call_deferred( &mut self, method: impl AsArg<StringName>, varargs: &[Variant], ) -> Result<Variant, CallError>
§Return type
This is a varcall method, meaning parameters and return values are passed as Variant.
It can detect call failures and will return Err in such a case.
pub fn set_deferred(
&mut self,
property: impl AsArg<StringName>,
value: &Variant,
)
pub fn set_deferred( &mut self, property: impl AsArg<StringName>, value: &Variant, )
Assigns value to the given property, at the end of the current frame. This is equivalent to calling set through call_deferred.
var node = Node2D.new()
add_child(node)
node.rotation = 1.5
node.set_deferred("rotation", 3.0)
print(node.rotation) # Prints 1.5
await get_tree().process_frame
print(node.rotation) # Prints 3.0Note: In C#, property must be in snake_case when referring to built-in Godot properties. Prefer using the names exposed in the PropertyName class to avoid allocating a new StringName on each call.
pub fn callv(
&mut self,
method: impl AsArg<StringName>,
arg_array: &AnyArray,
) -> Variant
pub fn callv( &mut self, method: impl AsArg<StringName>, arg_array: &AnyArray, ) -> Variant
Calls the method on the object and returns the result. Unlike call, this method expects all parameters to be contained inside arg_array.
var node = Node3D.new()
node.callv("rotate", [Vector3(1.0, 0.0, 0.0), 1.571])Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.
pub fn has_method(&self, method: impl AsArg<StringName>) -> bool
pub fn has_method(&self, method: impl AsArg<StringName>) -> bool
Returns true if the given method name exists in the object.
Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.
pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32
pub fn get_method_argument_count(&self, method: impl AsArg<StringName>) -> i32
Returns the number of arguments of the given method by name.
Note: In C#, method must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the MethodName class to avoid allocating a new StringName on each call.
pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool
pub fn has_signal(&self, signal: impl AsArg<StringName>) -> bool
Returns true if the given signal name exists in the object.
Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.
pub fn get_signal_list(&self) -> Array<Dictionary<Variant, Variant>>
pub fn get_signal_list(&self) -> Array<Dictionary<Variant, Variant>>
Returns the list of existing signals as an Array of dictionaries.
Note: Due to the implementation, each Dictionary is formatted very similarly to the returned values of get_method_list.
pub fn get_signal_connection_list(
&self,
signal: impl AsArg<StringName>,
) -> Array<Dictionary<Variant, Variant>>
pub fn get_signal_connection_list( &self, signal: impl AsArg<StringName>, ) -> Array<Dictionary<Variant, Variant>>
Returns an Array of connections for the given signal name. Each connection is represented as a Dictionary that contains three entries:
pub fn get_incoming_connections(&self) -> Array<Dictionary<Variant, Variant>>
pub fn get_incoming_connections(&self) -> Array<Dictionary<Variant, Variant>>
Returns an Array of signal connections received by this object. Each connection is represented as a Dictionary that contains three entries:
pub fn disconnect(
&mut self,
signal: impl AsArg<StringName>,
callable: &Callable,
)
pub fn disconnect( &mut self, signal: impl AsArg<StringName>, callable: &Callable, )
Disconnects a signal by name from a given callable. If the connection does not exist, generates an error. Use is_connected to make sure that the connection exists.
pub fn is_connected(
&self,
signal: impl AsArg<StringName>,
callable: &Callable,
) -> bool
pub fn is_connected( &self, signal: impl AsArg<StringName>, callable: &Callable, ) -> bool
Returns true if a connection exists between the given signal name and callable.
Note: In C#, signal must be in snake_case when referring to built-in Godot signals. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.
pub fn has_connections(&self, signal: impl AsArg<StringName>) -> bool
pub fn has_connections(&self, signal: impl AsArg<StringName>) -> bool
Returns true if any connection exists on the given signal name.
Note: In C#, signal must be in snake_case when referring to built-in Godot methods. Prefer using the names exposed in the SignalName class to avoid allocating a new StringName on each call.
pub fn set_block_signals(&mut self, enable: bool)
pub fn set_block_signals(&mut self, enable: bool)
If set to true, the object becomes unable to emit signals. As such, emit_signal and signal connections will not work, until it is set to false.
pub fn is_blocking_signals(&self) -> bool
pub fn is_blocking_signals(&self) -> bool
Returns true if the object is blocking its signals from being emitted. See set_block_signals.
pub fn notify_property_list_changed(&mut self)
pub fn notify_property_list_changed(&mut self)
Emits the property_list_changed signal. This is mainly used to refresh the editor, so that the Inspector and editor plugins are properly updated.
pub fn set_message_translation(&mut self, enable: bool)
pub fn set_message_translation(&mut self, enable: bool)
If set to true, allows the object to translate messages with tr and tr_n. Enabled by default. See also can_translate_messages.
pub fn can_translate_messages(&self) -> bool
pub fn can_translate_messages(&self) -> bool
Returns true if the object is allowed to translate messages with tr and tr_n. See also set_message_translation.
pub fn tr(&self, message: impl AsArg<StringName>) -> GString
pub fn tr(&self, message: impl AsArg<StringName>) -> GString
To set the default parameters, use tr_ex and its builder methods. See the book for detailed usage instructions.
Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.
For detailed examples, see Internationalizing games.
Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.
pub fn tr_ex<'ex>(&'ex self, message: impl AsArg<StringName> + 'ex) -> ExTr<'ex>
pub fn tr_ex<'ex>(&'ex self, message: impl AsArg<StringName> + 'ex) -> ExTr<'ex>
Translates a message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation. Note that most Control nodes automatically translate their strings, so this method is mostly useful for formatted strings or custom drawn text.
If can_translate_messages is false, or no translation is available, this method returns the message without changes. See set_message_translation.
For detailed examples, see Internationalizing games.
Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate.
pub fn tr_n(
&self,
message: impl AsArg<StringName>,
plural_message: impl AsArg<StringName>,
n: i32,
) -> GString
pub fn tr_n( &self, message: impl AsArg<StringName>, plural_message: impl AsArg<StringName>, n: i32, ) -> GString
To set the default parameters, use tr_n_ex and its builder methods. See the book for detailed usage instructions.
Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.
If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.
The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.
For detailed examples, see Localization using gettext.
Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.
Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.
pub fn tr_n_ex<'ex>(
&'ex self,
message: impl AsArg<StringName> + 'ex,
plural_message: impl AsArg<StringName> + 'ex,
n: i32,
) -> ExTrN<'ex>
pub fn tr_n_ex<'ex>( &'ex self, message: impl AsArg<StringName> + 'ex, plural_message: impl AsArg<StringName> + 'ex, n: i32, ) -> ExTrN<'ex>
Translates a message or plural_message, using the translation catalogs configured in the Project Settings. Further context can be specified to help with the translation.
If can_translate_messages is false, or no translation is available, this method returns message or plural_message, without changes. See set_message_translation.
The n is the number, or amount, of the message’s subject. It is used by the translation system to fetch the correct plural form for the current language.
For detailed examples, see Localization using gettext.
Note: Negative and float numbers may not properly apply to some countable subjects. It’s recommended to handle these cases with tr.
Note: This method can’t be used without an Object instance, as it requires the can_translate_messages method. To translate strings in a static context, use translate_plural.
pub fn get_translation_domain(&self) -> StringName
pub fn get_translation_domain(&self) -> StringName
Returns the name of the translation domain used by tr and tr_n. See also TranslationServer.
pub fn set_translation_domain(&mut self, domain: impl AsArg<StringName>)
pub fn set_translation_domain(&mut self, domain: impl AsArg<StringName>)
Sets the name of the translation domain used by tr and tr_n. See also TranslationServer.
pub fn is_queued_for_deletion(&self) -> bool
pub fn is_queued_for_deletion(&self) -> bool
Returns true if the queue_free method was called for the object.
pub fn cancel_free(&mut self)
pub fn cancel_free(&mut self)
If this method is called during ObjectNotification::PREDELETE, this object will reject being freed and will remain allocated. This is mostly an internal function used for error handling to avoid the user from freeing objects when they are not intended to.
pub fn notify(&mut self, what: ObjectNotification)
pub fn notify(&mut self, what: ObjectNotification)
⚠️ Sends a Godot notification to all classes inherited by the object.
Triggers calls to on_notification(), and depending on the notification, also to Godot’s lifecycle callbacks such as ready().
Starts from the highest ancestor (the Object class) and goes down the hierarchy.
See also Godot docs for Object::notification().
§Panics
If you call this method on a user-defined object while holding a GdRef or GdMut guard on the instance, you will encounter
a panic. The reason is that the receiving virtual method on_notification() acquires a GdMut lock dynamically, which must
be exclusive.
pub fn notify_reversed(&mut self, what: ObjectNotification)
pub fn notify_reversed(&mut self, what: ObjectNotification)
⚠️ Like Self::notify(), but starts at the most-derived class and goes up the hierarchy.
See docs of that method, including the panics.
Trait Implementations§
§impl GodotClass for Fabrik3d
impl GodotClass for Fabrik3d
§const INIT_LEVEL: InitLevel = crate::init::InitLevel::Scene
const INIT_LEVEL: InitLevel = crate::init::InitLevel::Scene
§type Base = IterateIk3d
type Base = IterateIk3d
T. This is always a Godot engine class.§fn class_id() -> ClassId
fn class_id() -> ClassId
§fn inherits<Base>() -> boolwhere
Base: GodotClass,
fn inherits<Base>() -> boolwhere
Base: GodotClass,
§impl Inherits<ChainIk3d> for Fabrik3d
impl Inherits<ChainIk3d> for Fabrik3d
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read more§impl Inherits<IkModifier3D> for Fabrik3d
impl Inherits<IkModifier3D> for Fabrik3d
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read more§impl Inherits<IterateIk3d> for Fabrik3d
impl Inherits<IterateIk3d> for Fabrik3d
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read more§impl Inherits<Node3D> for Fabrik3d
impl Inherits<Node3D> for Fabrik3d
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read more§impl Inherits<Object> for Fabrik3d
impl Inherits<Object> for Fabrik3d
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read more§impl Inherits<SkeletonModifier3D> for Fabrik3d
impl Inherits<SkeletonModifier3D> for Fabrik3d
§const IS_SAME_CLASS: bool = false
const IS_SAME_CLASS: bool = false
Self == Base. Read more§impl WithSignals for Fabrik3d
impl WithSignals for Fabrik3d
§type SignalCollection<'c, C: WithSignals> = SignalsOfSkeletonModifier3D<'c, C>
type SignalCollection<'c, C: WithSignals> = SignalsOfSkeletonModifier3D<'c, C>
impl GodotDefault for Fabrik3d
Auto Trait Implementations§
impl Freeze for Fabrik3d
impl RefUnwindSafe for Fabrik3d
impl !Send for Fabrik3d
impl !Sync for Fabrik3d
impl Unpin for Fabrik3d
impl UnsafeUnpin for Fabrik3d
impl UnwindSafe for Fabrik3d
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> Inherits<T> for Twhere
T: GodotClass,
impl<T> Inherits<T> for Twhere
T: GodotClass,
§const IS_SAME_CLASS: bool = true
const IS_SAME_CLASS: bool = true
Self == Base. Read more