Index · Object → Node → Node3D → Skeleton3D

Skeleton3D

A node containing a bone hierarchy, used to create a 3D skeletal animation.

Class Description

Skeleton3D provides an interface for managing a hierarchy of bones, including pose, rest and animation (see Animation). It can also use ragdoll physics.

The overall transform of a bone with respect to the skeleton is determined by bone pose. Bone rest defines the initial transform of the bone pose.

Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it is not the actual global/world transform of the bone.

Properties

var animate_physical_bones: bool = true

If you follow the recommended workflow and explicitly have PhysicalBoneSimulator3D as a child of Skeleton3D, you can control whether it is affected by raycasting without running physical_bones_start_simulation(), by its SkeletonModifier3D.active.

However, for old (deprecated) configurations, Skeleton3D has an internal virtual PhysicalBoneSimulator3D for compatibility. This property controls the internal virtual PhysicalBoneSimulator3D's SkeletonModifier3D.active.

var modifier_callback_mode_process: Skeleton3D.ModifierCallbackModeProcess = 1

Sets the processing timing for the Modifier.

var motion_scale: float = 1.0

Multiplies the 3D position track animation.

Note: Unless this value is 1.0, the key value in animation will not match the actual position value.

var show_rest_only: bool = false

If true, forces the bones in their default rest pose, regardless of their values. In the editor, this also prevents the bones from being edited.

Inherited from Node3D (17)
var position: Vector3 = Vector3(0, 0, 0)
var rotation: Vector3 = Vector3(0, 0, 0)
var rotation_order: EulerOrder = 2
var scale: Vector3 = Vector3(1, 1, 1)
var top_level: bool = false
var transform: Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
var visibility_parent: NodePath = NodePath("")
var visible: bool = true
Inherited from Node (14)
var owner: Node

Methods

func add_bone(name: String) -> int

Adds a new bone with the given name. Returns the new bone's index, or -1 if this method fails.

Note: Bone names should be unique, non empty, and cannot include the : and / characters.

func advance(delta: float) -> void

Manually advance the child SkeletonModifier3Ds by the specified time (in seconds).

Note: The delta is temporarily accumulated in the Skeleton3D, and the deferred process uses the accumulated value to process the modification.

func clear_bones() -> void

Clear all the bones in this skeleton.

func clear_bones_global_pose_override() -> void

Removes the global pose override on all bones in the skeleton.

func create_skin_from_rest_transforms() -> Skin
func find_bone(name: String) -> int

Returns the bone index that matches name as its name. Returns -1 if no bone with this name exists.

func force_update_all_bone_transforms() -> void

Force updates the bone transforms/poses for all bones in the skeleton.

func force_update_bone_child_transform(bone_idx: int) -> void

Force updates the bone transform for the bone at bone_idx and all of its children.

func get_bone_children(bone_idx: int) -> PackedInt32Array

Returns an array containing the bone indexes of all the child node of the passed in bone, bone_idx.

func get_bone_count() -> int

Returns the number of bones in the skeleton.

func get_bone_global_pose(bone_idx: int) -> Transform3D

Returns the overall transform of the specified bone, with respect to the skeleton. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.

Note: This is the global pose you set to the skeleton in the process, the final global pose can get overridden by modifiers in the deferred process, if you want to access the final global pose, use SkeletonModifier3D.modification_processed.

func get_bone_global_pose_no_override(bone_idx: int) -> Transform3D

Returns the overall transform of the specified bone, with respect to the skeleton, but without any global pose overrides. Being relative to the skeleton frame, this is not the actual "global" transform of the bone.

func get_bone_global_pose_override(bone_idx: int) -> Transform3D

Returns the global pose override transform for bone_idx.

func get_bone_global_rest(bone_idx: int) -> Transform3D

Returns the global rest transform for bone_idx.

func get_bone_meta(bone_idx: int, key: StringName) -> Variant

Returns the metadata with the given key for the bone at index bone_idx.

func get_bone_meta_list(bone_idx: int) -> StringName[]

Returns the list of all metadata keys for the bone at index bone_idx.

func get_bone_name(bone_idx: int) -> String

Returns the name of the bone at index bone_idx.

func get_bone_parent(bone_idx: int) -> int

Returns the bone index which is the parent of the bone at bone_idx. If -1, then bone has no parent.

Note: The parent bone returned will always be less than bone_idx.

func get_bone_pose(bone_idx: int) -> Transform3D

Returns the pose transform of the specified bone.

Note: This is the pose you set to the skeleton in the process, the final pose can get overridden by modifiers in the deferred process, if you want to access the final pose, use SkeletonModifier3D.modification_processed.

func get_bone_pose_position(bone_idx: int) -> Vector3

Returns the pose position of the bone at bone_idx. The returned Vector3 is in the local coordinate space of the Skeleton3D node.

func get_bone_pose_rotation(bone_idx: int) -> Quaternion

Returns the pose rotation of the bone at bone_idx. The returned Quaternion is local to the bone with respect to the rotation of any parent bones.

func get_bone_pose_scale(bone_idx: int) -> Vector3

Returns the pose scale of the bone at bone_idx.

func get_bone_rest(bone_idx: int) -> Transform3D

Returns the rest transform for a bone bone_idx.

func get_concatenated_bone_names() -> StringName

Returns all bone names concatenated with commas (,) as a single StringName.

It is useful to set it as a hint for the enum property.

func get_parentless_bones() -> PackedInt32Array

Returns an array with all of the bones that are parentless. Another way to look at this is that it returns the indexes of all the bones that are not dependent or modified by other bones in the Skeleton.

func get_version() -> int

Returns the number of times the bone hierarchy has changed within this skeleton, including renames.

The Skeleton version is not serialized: only use within a single instance of Skeleton3D.

Use for invalidating caches in IK solvers and other nodes which process bones.

func has_bone_meta(bone_idx: int, key: StringName) -> bool

Returns true if the bone at index bone_idx has metadata with the given key.

func is_bone_enabled(bone_idx: int) -> bool

Returns whether the bone pose for the bone at bone_idx is enabled.

func localize_rests() -> void

Returns all bones in the skeleton to their rest poses.

func physical_bones_add_collision_exception(exception: RID) -> void

Adds a collision exception to the physical bone.

Works just like the RigidBody3D node.

func physical_bones_remove_collision_exception(exception: RID) -> void

Removes a collision exception to the physical bone.

Works just like the RigidBody3D node.

func physical_bones_start_simulation(bones: StringName[] = []) -> void

Tells the PhysicalBone3D nodes in the Skeleton to start simulating and reacting to the physics world.

Optionally, a list of bone names can be passed-in, allowing only the passed-in bones to be simulated.

func physical_bones_stop_simulation() -> void

Tells the PhysicalBone3D nodes in the Skeleton to stop simulating.

func register_skin(skin: Skin) -> SkinReference

Binds the given Skin to the Skeleton.

func reset_bone_pose(bone_idx: int) -> void

Sets the bone pose to rest for bone_idx.

func reset_bone_poses() -> void

Sets all bone poses to rests.

func set_bone_enabled(bone_idx: int, enabled: bool = true) -> void

Disables the pose for the bone at bone_idx if false, enables the bone pose if true.

func set_bone_global_pose(bone_idx: int, pose: Transform3D) -> void

Sets the global pose transform, pose, for the bone at bone_idx.

Note: If other bone poses have been changed, this method executes a dirty poses recalculation and will cause performance to deteriorate. If you know that multiple global poses will be applied, consider using set_bone_pose() with precalculation.

func set_bone_global_pose_override(bone_idx: int, pose: Transform3D, amount: float, persistent: bool = false) -> void

Sets the global pose transform, pose, for the bone at bone_idx.

amount is the interpolation strength that will be used when applying the pose, and persistent determines if the applied pose will remain.

Note: The pose transform needs to be a global pose! To convert a world transform from a Node3D to a global bone pose, multiply the Transform3D.affine_inverse() of the node's Node3D.global_transform by the desired world transform.

func set_bone_meta(bone_idx: int, key: StringName, value: Variant) -> void

Sets the metadata with the given key to value for the bone at index bone_idx.

func set_bone_name(bone_idx: int, name: String) -> void

Sets the bone name, name, for the bone at bone_idx.

func set_bone_parent(bone_idx: int, parent_idx: int) -> void

Sets the bone index parent_idx as the parent of the bone at bone_idx. If -1, then bone has no parent.

Note: parent_idx must be less than bone_idx.

func set_bone_pose(bone_idx: int, pose: Transform3D) -> void

Sets the pose transform, pose, for the bone at bone_idx.

func set_bone_pose_position(bone_idx: int, position: Vector3) -> void

Sets the pose position of the bone at bone_idx to position. position is a Vector3 describing a position local to the Skeleton3D node.

func set_bone_pose_rotation(bone_idx: int, rotation: Quaternion) -> void

Sets the pose rotation of the bone at bone_idx to rotation. rotation is a Quaternion describing a rotation in the bone's local coordinate space with respect to the rotation of any parent bones.

func set_bone_pose_scale(bone_idx: int, scale: Vector3) -> void

Sets the pose scale of the bone at bone_idx to scale.

func set_bone_rest(bone_idx: int, rest: Transform3D) -> void

Sets the rest transform for bone bone_idx.

func unparent_bone_and_rest(bone_idx: int) -> void

Unparents the bone at bone_idx and sets its rest position to that of its parent prior to being reset.

Inherited from Node3D (37)
func add_gizmo(gizmo: Node3DGizmo) -> void
func clear_gizmos() -> void
func force_update_transform() -> void
func get_gizmos() -> Node3DGizmo[]
func global_rotate(axis: Vector3, angle: float) -> void
func global_scale(scale: Vector3) -> void
func global_translate(offset: Vector3) -> void
func hide() -> void
func look_at(target: Vector3, up: Vector3 = Vector3(0, 1, 0), use_model_front: bool = false) -> void
func look_at_from_position(position: Vector3, target: Vector3, up: Vector3 = Vector3(0, 1, 0), use_model_front: bool = false) -> void
func orthonormalize() -> void
func rotate(axis: Vector3, angle: float) -> void
func rotate_object_local(axis: Vector3, angle: float) -> void
func rotate_x(angle: float) -> void
func rotate_y(angle: float) -> void
func rotate_z(angle: float) -> void
func scale_object_local(scale: Vector3) -> void
func set_disable_scale(disable: bool) -> void
func set_identity() -> void
func set_notify_local_transform(enable: bool) -> void
func set_notify_transform(enable: bool) -> void
func set_subgizmo_selection(gizmo: Node3DGizmo, id: int, transform: Transform3D) -> void
func show() -> void
func to_global(local_point: Vector3) -> Vector3
func to_local(global_point: Vector3) -> Vector3
func translate(offset: Vector3) -> void
func translate_object_local(offset: Vector3) -> void
func update_gizmos() -> void
Inherited from Node (106)
func _enter_tree() -> void
func _exit_tree() -> void
func _input(event: InputEvent) -> void
func _physics_process(delta: float) -> void
func _process(delta: float) -> void
func _ready() -> void
func _shortcut_input(event: InputEvent) -> void
func _unhandled_input(event: InputEvent) -> void
func _unhandled_key_input(event: InputEvent) -> void
func add_child(node: Node, force_readable_name: bool = false, internal: Node.InternalMode = 0) -> void
func add_sibling(sibling: Node, force_readable_name: bool = false) -> void
func add_to_group(group: StringName, persistent: bool = false) -> void
func atr(message: String, context: StringName = "") -> String
func atr_n(message: String, plural_message: StringName, n: int, context: StringName = "") -> String
func can_process() -> bool
func duplicate(flags: int = 15) -> Node
func find_child(pattern: String, recursive: bool = true, owned: bool = true) -> Node
func find_children(pattern: String, type: String = "", recursive: bool = true, owned: bool = true) -> Node[]
func find_parent(pattern: String) -> Node
func get_child(idx: int, include_internal: bool = false) -> Node
func get_child_count(include_internal: bool = false) -> int
func get_children(include_internal: bool = false) -> Node[]
func get_groups() -> StringName[]
func get_index(include_internal: bool = false) -> int
func get_node(path: NodePath) -> Node
func get_orphan_node_ids() -> int[]
func get_parent() -> Node
func get_path() -> NodePath
func get_path_to(node: Node, use_unique_path: bool = false) -> NodePath
func get_window() -> Window
func has_node(path: NodePath) -> bool
func is_ancestor_of(node: Node) -> bool
func is_greater_than(node: Node) -> bool
func is_in_group(group: StringName) -> bool
func move_child(child_node: Node, to_index: int) -> void
func notify_deferred_thread_group(what: int) -> void
func notify_thread_safe(what: int) -> void
func print_orphan_nodes() -> void
func print_tree() -> void
func print_tree_pretty() -> void
func propagate_call(method: StringName, args: Array = [], parent_first: bool = false) -> void
func propagate_notification(what: int) -> void
func queue_free() -> void
func remove_child(node: Node) -> void
func remove_from_group(group: StringName) -> void
func reparent(new_parent: Node, keep_global_transform: bool = true) -> void
func replace_by(node: Node, keep_groups: bool = false) -> void
func request_ready() -> void
func rpc(method: StringName) -> Error
func rpc_config(method: StringName, config: Variant) -> void
func rpc_id(peer_id: int, method: StringName) -> Error
func set_deferred_thread_group(property: StringName, value: Variant) -> void
func set_display_folded(fold: bool) -> void
func set_editable_instance(node: Node, is_editable: bool) -> void
func set_multiplayer_authority(id: int, recursive: bool = true) -> void
func set_physics_process(enable: bool) -> void
func set_physics_process_internal(enable: bool) -> void
func set_process(enable: bool) -> void
func set_process_input(enable: bool) -> void
func set_process_internal(enable: bool) -> void
func set_process_shortcut_input(enable: bool) -> void
func set_process_unhandled_input(enable: bool) -> void
func set_scene_instance_load_placeholder(load_placeholder: bool) -> void
func set_thread_safe(property: StringName, value: Variant) -> void
Inherited from Object (62)
func _get(property: StringName) -> Variant
func _get_property_list() -> Dictionary[]
func _init() -> void
func _iter_get(iter: Variant) -> Variant
func _iter_init(iter: Array) -> bool
func _iter_next(iter: Array) -> bool
func _notification(what: int) -> void
func _set(property: StringName, value: Variant) -> bool
func _to_string() -> String
func _validate_property(property: Dictionary) -> void
func add_user_signal(signal: String, arguments: Array = []) -> void
func call(method: StringName) -> Variant
func callv(method: StringName, arg_array: Array) -> Variant
func cancel_free() -> void
func connect(signal: StringName, callable: Callable, flags: int = 0) -> Error
func disconnect(signal: StringName, callable: Callable) -> void
func emit_signal(signal: StringName) -> Error
func free() -> void
func get(property: StringName) -> Variant
func get_class() -> String
func get_incoming_connections() -> Dictionary[]
func get_indexed(property_path: NodePath) -> Variant
func get_meta(name: StringName, default: Variant = null) -> Variant
func get_meta_list() -> StringName[]
func get_method_list() -> Dictionary[]
func get_property_list() -> Dictionary[]
func get_signal_connection_list(signal: StringName) -> Dictionary[]
func get_signal_list() -> Dictionary[]
func has_meta(name: StringName) -> bool
func has_method(method: StringName) -> bool
func has_signal(signal: StringName) -> bool
func is_class(class: StringName) -> bool
func is_connected(signal: StringName, callable: Callable) -> bool
func notification(what: int, reversed: bool = false) -> void
func remove_meta(name: StringName) -> void
func remove_user_signal(signal: StringName) -> void
func set(property: StringName, value: Variant) -> void
func set_block_signals(enable: bool) -> void
func set_deferred(property: StringName, value: Variant) -> void
func set_indexed(property_path: NodePath, value: Variant) -> void
func set_message_translation(enable: bool) -> void
func set_meta(name: StringName, value: Variant) -> void
func set_script(script: Variant) -> void
func set_translation_domain(domain: StringName) -> void
func to_string() -> String
func tr(message: StringName, context: StringName = &"") -> String
func tr_n(message: StringName, plural_message: StringName, n: int, context: StringName = &"") -> String

Signals

signal bone_enabled_changed(bone_idx: int)

Emitted when the bone at bone_idx is toggled with set_bone_enabled(). Use is_bone_enabled() to check the new value.

signal bone_list_changed()

Emitted when the list of bones changes, such as when calling add_bone(), set_bone_parent(), unparent_bone_and_rest(), or clear_bones().

signal pose_updated()

Emitted when the pose is updated.

Note: During the update process, this signal is not fired, so modification by SkeletonModifier3D is not detected.

signal rest_updated()

Emitted when the rest is updated.

signal show_rest_only_changed()

Emitted when the value of show_rest_only changes.

signal skeleton_updated()

Emitted when the final pose has been calculated will be applied to the skin in the update process.

This means that all SkeletonModifier3D processing is complete. In order to detect the completion of the processing of each SkeletonModifier3D, use SkeletonModifier3D.modification_processed.

Inherited from Node3D (1)
Inherited from Node (11)
signal child_entered_tree(node: Node)
signal child_exiting_tree(node: Node)
signal ready()
signal renamed()
signal replacing_by(node: Node)
signal tree_entered()
signal tree_exited()
signal tree_exiting()
Inherited from Object (2)

Enums & Constants

enum ModifierCallbackModeProcess
MODIFIER_CALLBACK_MODE_PROCESS_PHYSICS = 0

Set a flag to process modification during physics frames (see Node.NOTIFICATION_INTERNAL_PHYSICS_PROCESS).

MODIFIER_CALLBACK_MODE_PROCESS_IDLE = 1

Set a flag to process modification during process frames (see Node.NOTIFICATION_INTERNAL_PROCESS).

MODIFIER_CALLBACK_MODE_PROCESS_MANUAL = 2

Do not process modification. Use advance() to process the modification manually.

const NOTIFICATION_UPDATE_SKELETON = 50

Notification received when this skeleton's pose needs to be updated. In that case, this is called only once per frame in a deferred process.