:github_url: hide .. Generated automatically by doc/tools/makerst.py in Godot's source tree. .. DO NOT EDIT THIS FILE, but the Skeleton.xml source instead. .. The source is found in doc/classes or modules//doc_classes. .. _class_Skeleton: Skeleton ======== **Inherits:** :ref:`Spatial` **<** :ref:`Node` **<** :ref:`Object` Skeleton for characters and animated objects. Description ----------- Skeleton provides a hierarchical interface for managing bones, including pose, rest and animation (see :ref:`Animation`). It can also use ragdoll physics. The overall transform of a bone with respect to the skeleton is determined by the following hierarchical order: rest pose, custom pose and pose. Note that "global pose" below refers to the overall transform of the bone with respect to skeleton, so it not the actual global/world transform of the bone. Methods ------- +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`add_bone` **(** :ref:`String` name **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`bind_child_node_to_bone` **(** :ref:`int` bone_idx, :ref:`Node` node **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_bones` **(** **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`clear_bones_global_pose_override` **(** **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`find_bone` **(** :ref:`String` name **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bone_count` **(** **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`get_bone_custom_pose` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`get_bone_global_pose` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`String` | :ref:`get_bone_name` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`int` | :ref:`get_bone_parent` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`get_bone_pose` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Transform` | :ref:`get_bone_rest` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Array` | :ref:`get_bound_child_nodes_to_bone` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`bool` | :ref:`is_bone_rest_disabled` **(** :ref:`int` bone_idx **)** |const| | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`localize_rests` **(** **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`physical_bones_add_collision_exception` **(** :ref:`RID` exception **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`physical_bones_remove_collision_exception` **(** :ref:`RID` exception **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`physical_bones_start_simulation` **(** :ref:`Array` bones=[ ] **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`physical_bones_stop_simulation` **(** **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`SkinReference` | :ref:`register_skin` **(** :ref:`Skin` skin **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bone_custom_pose` **(** :ref:`int` bone_idx, :ref:`Transform` custom_pose **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bone_disable_rest` **(** :ref:`int` bone_idx, :ref:`bool` disable **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bone_global_pose_override` **(** :ref:`int` bone_idx, :ref:`Transform` pose, :ref:`float` amount, :ref:`bool` persistent=false **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bone_parent` **(** :ref:`int` bone_idx, :ref:`int` parent_idx **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bone_pose` **(** :ref:`int` bone_idx, :ref:`Transform` pose **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`set_bone_rest` **(** :ref:`int` bone_idx, :ref:`Transform` rest **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`unbind_child_node_from_bone` **(** :ref:`int` bone_idx, :ref:`Node` node **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`unparent_bone_and_rest` **(** :ref:`int` bone_idx **)** | +-------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ Constants --------- .. _class_Skeleton_constant_NOTIFICATION_UPDATE_SKELETON: - **NOTIFICATION_UPDATE_SKELETON** = **50** Method Descriptions ------------------- .. _class_Skeleton_method_add_bone: - void **add_bone** **(** :ref:`String` name **)** Adds a bone, with name ``name``. :ref:`get_bone_count` will become the bone index. ---- .. _class_Skeleton_method_bind_child_node_to_bone: - void **bind_child_node_to_bone** **(** :ref:`int` bone_idx, :ref:`Node` node **)** *Deprecated soon.* ---- .. _class_Skeleton_method_clear_bones: - void **clear_bones** **(** **)** Clear all the bones in this skeleton. ---- .. _class_Skeleton_method_clear_bones_global_pose_override: - void **clear_bones_global_pose_override** **(** **)** ---- .. _class_Skeleton_method_find_bone: - :ref:`int` **find_bone** **(** :ref:`String` name **)** |const| Returns the bone index that matches ``name`` as its name. ---- .. _class_Skeleton_method_get_bone_count: - :ref:`int` **get_bone_count** **(** **)** |const| Returns the amount of bones in the skeleton. ---- .. _class_Skeleton_method_get_bone_custom_pose: - :ref:`Transform` **get_bone_custom_pose** **(** :ref:`int` bone_idx **)** |const| Returns the custom pose of the specified bone. Custom pose is applied on top of the rest pose. ---- .. _class_Skeleton_method_get_bone_global_pose: - :ref:`Transform` **get_bone_global_pose** **(** :ref:`int` bone_idx **)** |const| 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. ---- .. _class_Skeleton_method_get_bone_name: - :ref:`String` **get_bone_name** **(** :ref:`int` bone_idx **)** |const| Returns the name of the bone at index ``index``. ---- .. _class_Skeleton_method_get_bone_parent: - :ref:`int` **get_bone_parent** **(** :ref:`int` bone_idx **)** |const| 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``. ---- .. _class_Skeleton_method_get_bone_pose: - :ref:`Transform` **get_bone_pose** **(** :ref:`int` bone_idx **)** |const| Returns the pose transform of the specified bone. Pose is applied on top of the custom pose, which is applied on top the rest pose. ---- .. _class_Skeleton_method_get_bone_rest: - :ref:`Transform` **get_bone_rest** **(** :ref:`int` bone_idx **)** |const| Returns the rest transform for a bone ``bone_idx``. ---- .. _class_Skeleton_method_get_bound_child_nodes_to_bone: - :ref:`Array` **get_bound_child_nodes_to_bone** **(** :ref:`int` bone_idx **)** |const| *Deprecated soon.* ---- .. _class_Skeleton_method_is_bone_rest_disabled: - :ref:`bool` **is_bone_rest_disabled** **(** :ref:`int` bone_idx **)** |const| ---- .. _class_Skeleton_method_localize_rests: - void **localize_rests** **(** **)** ---- .. _class_Skeleton_method_physical_bones_add_collision_exception: - void **physical_bones_add_collision_exception** **(** :ref:`RID` exception **)** ---- .. _class_Skeleton_method_physical_bones_remove_collision_exception: - void **physical_bones_remove_collision_exception** **(** :ref:`RID` exception **)** ---- .. _class_Skeleton_method_physical_bones_start_simulation: - void **physical_bones_start_simulation** **(** :ref:`Array` bones=[ ] **)** ---- .. _class_Skeleton_method_physical_bones_stop_simulation: - void **physical_bones_stop_simulation** **(** **)** ---- .. _class_Skeleton_method_register_skin: - :ref:`SkinReference` **register_skin** **(** :ref:`Skin` skin **)** ---- .. _class_Skeleton_method_set_bone_custom_pose: - void **set_bone_custom_pose** **(** :ref:`int` bone_idx, :ref:`Transform` custom_pose **)** ---- .. _class_Skeleton_method_set_bone_disable_rest: - void **set_bone_disable_rest** **(** :ref:`int` bone_idx, :ref:`bool` disable **)** ---- .. _class_Skeleton_method_set_bone_global_pose_override: - void **set_bone_global_pose_override** **(** :ref:`int` bone_idx, :ref:`Transform` pose, :ref:`float` amount, :ref:`bool` persistent=false **)** ---- .. _class_Skeleton_method_set_bone_parent: - void **set_bone_parent** **(** :ref:`int` bone_idx, :ref:`int` parent_idx **)** 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``. ---- .. _class_Skeleton_method_set_bone_pose: - void **set_bone_pose** **(** :ref:`int` bone_idx, :ref:`Transform` pose **)** Sets the pose transform for bone ``bone_idx``. ---- .. _class_Skeleton_method_set_bone_rest: - void **set_bone_rest** **(** :ref:`int` bone_idx, :ref:`Transform` rest **)** Sets the rest transform for bone ``bone_idx``. ---- .. _class_Skeleton_method_unbind_child_node_from_bone: - void **unbind_child_node_from_bone** **(** :ref:`int` bone_idx, :ref:`Node` node **)** *Deprecated soon.* ---- .. _class_Skeleton_method_unparent_bone_and_rest: - void **unparent_bone_and_rest** **(** :ref:`int` bone_idx **)** .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`