class_skeleton3d.rst 45 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.2/doc/classes/Skeleton3D.xml.
  6. .. _class_Skeleton3D:
  7. Skeleton3D
  8. ==========
  9. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  10. A node containing a bone hierarchy, used to create a 3D skeletal animation.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **Skeleton3D** provides an interface for managing a hierarchy of bones, including pose, rest and animation (see :ref:`Animation<class_Animation>`). It can also use ragdoll physics.
  15. 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.
  16. 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.
  17. .. rst-class:: classref-introduction-group
  18. Tutorials
  19. ---------
  20. - `3D Inverse Kinematics Demo <https://godotengine.org/asset-library/asset/523>`__
  21. - `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
  22. .. rst-class:: classref-reftable-group
  23. Properties
  24. ----------
  25. .. table::
  26. :widths: auto
  27. +---------------------------+---------------------------------------------------------------------------------+-----------+
  28. | :ref:`bool<class_bool>` | :ref:`animate_physical_bones<class_Skeleton3D_property_animate_physical_bones>` | ``true`` |
  29. +---------------------------+---------------------------------------------------------------------------------+-----------+
  30. | :ref:`float<class_float>` | :ref:`motion_scale<class_Skeleton3D_property_motion_scale>` | ``1.0`` |
  31. +---------------------------+---------------------------------------------------------------------------------+-----------+
  32. | :ref:`bool<class_bool>` | :ref:`show_rest_only<class_Skeleton3D_property_show_rest_only>` | ``false`` |
  33. +---------------------------+---------------------------------------------------------------------------------+-----------+
  34. .. rst-class:: classref-reftable-group
  35. Methods
  36. -------
  37. .. table::
  38. :widths: auto
  39. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | void | :ref:`add_bone<class_Skeleton3D_method_add_bone>` **(** :ref:`String<class_String>` name **)** |
  41. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | void | :ref:`clear_bones<class_Skeleton3D_method_clear_bones>` **(** **)** |
  43. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | void | :ref:`clear_bones_global_pose_override<class_Skeleton3D_method_clear_bones_global_pose_override>` **(** **)** |
  45. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`Skin<class_Skin>` | :ref:`create_skin_from_rest_transforms<class_Skeleton3D_method_create_skin_from_rest_transforms>` **(** **)** |
  47. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`find_bone<class_Skeleton3D_method_find_bone>` **(** :ref:`String<class_String>` name **)** |const| |
  49. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | void | :ref:`force_update_all_bone_transforms<class_Skeleton3D_method_force_update_all_bone_transforms>` **(** **)** |
  51. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | void | :ref:`force_update_bone_child_transform<class_Skeleton3D_method_force_update_bone_child_transform>` **(** :ref:`int<class_int>` bone_idx **)** |
  53. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_bone_children<class_Skeleton3D_method_get_bone_children>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  55. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`int<class_int>` | :ref:`get_bone_count<class_Skeleton3D_method_get_bone_count>` **(** **)** |const| |
  57. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_bone_global_pose<class_Skeleton3D_method_get_bone_global_pose>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  59. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_bone_global_pose_no_override<class_Skeleton3D_method_get_bone_global_pose_no_override>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  61. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_bone_global_pose_override<class_Skeleton3D_method_get_bone_global_pose_override>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  63. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_bone_global_rest<class_Skeleton3D_method_get_bone_global_rest>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  65. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`String<class_String>` | :ref:`get_bone_name<class_Skeleton3D_method_get_bone_name>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  67. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`int<class_int>` | :ref:`get_bone_parent<class_Skeleton3D_method_get_bone_parent>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  69. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_bone_pose<class_Skeleton3D_method_get_bone_pose>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  71. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`Vector3<class_Vector3>` | :ref:`get_bone_pose_position<class_Skeleton3D_method_get_bone_pose_position>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  73. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Quaternion<class_Quaternion>` | :ref:`get_bone_pose_rotation<class_Skeleton3D_method_get_bone_pose_rotation>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  75. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`Vector3<class_Vector3>` | :ref:`get_bone_pose_scale<class_Skeleton3D_method_get_bone_pose_scale>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  77. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`Transform3D<class_Transform3D>` | :ref:`get_bone_rest<class_Skeleton3D_method_get_bone_rest>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  79. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`get_parentless_bones<class_Skeleton3D_method_get_parentless_bones>` **(** **)** |const| |
  81. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`int<class_int>` | :ref:`get_version<class_Skeleton3D_method_get_version>` **(** **)** |const| |
  83. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`bool<class_bool>` | :ref:`is_bone_enabled<class_Skeleton3D_method_is_bone_enabled>` **(** :ref:`int<class_int>` bone_idx **)** |const| |
  85. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | void | :ref:`localize_rests<class_Skeleton3D_method_localize_rests>` **(** **)** |
  87. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | void | :ref:`physical_bones_add_collision_exception<class_Skeleton3D_method_physical_bones_add_collision_exception>` **(** :ref:`RID<class_RID>` exception **)** |
  89. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | void | :ref:`physical_bones_remove_collision_exception<class_Skeleton3D_method_physical_bones_remove_collision_exception>` **(** :ref:`RID<class_RID>` exception **)** |
  91. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | void | :ref:`physical_bones_start_simulation<class_Skeleton3D_method_physical_bones_start_simulation>` **(** :ref:`StringName[]<class_StringName>` bones=[] **)** |
  93. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | void | :ref:`physical_bones_stop_simulation<class_Skeleton3D_method_physical_bones_stop_simulation>` **(** **)** |
  95. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`SkinReference<class_SkinReference>` | :ref:`register_skin<class_Skeleton3D_method_register_skin>` **(** :ref:`Skin<class_Skin>` skin **)** |
  97. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | void | :ref:`reset_bone_pose<class_Skeleton3D_method_reset_bone_pose>` **(** :ref:`int<class_int>` bone_idx **)** |
  99. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | void | :ref:`reset_bone_poses<class_Skeleton3D_method_reset_bone_poses>` **(** **)** |
  101. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | void | :ref:`set_bone_enabled<class_Skeleton3D_method_set_bone_enabled>` **(** :ref:`int<class_int>` bone_idx, :ref:`bool<class_bool>` enabled=true **)** |
  103. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. | void | :ref:`set_bone_global_pose_override<class_Skeleton3D_method_set_bone_global_pose_override>` **(** :ref:`int<class_int>` bone_idx, :ref:`Transform3D<class_Transform3D>` pose, :ref:`float<class_float>` amount, :ref:`bool<class_bool>` persistent=false **)** |
  105. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  106. | void | :ref:`set_bone_name<class_Skeleton3D_method_set_bone_name>` **(** :ref:`int<class_int>` bone_idx, :ref:`String<class_String>` name **)** |
  107. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  108. | void | :ref:`set_bone_parent<class_Skeleton3D_method_set_bone_parent>` **(** :ref:`int<class_int>` bone_idx, :ref:`int<class_int>` parent_idx **)** |
  109. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  110. | void | :ref:`set_bone_pose_position<class_Skeleton3D_method_set_bone_pose_position>` **(** :ref:`int<class_int>` bone_idx, :ref:`Vector3<class_Vector3>` position **)** |
  111. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  112. | void | :ref:`set_bone_pose_rotation<class_Skeleton3D_method_set_bone_pose_rotation>` **(** :ref:`int<class_int>` bone_idx, :ref:`Quaternion<class_Quaternion>` rotation **)** |
  113. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | void | :ref:`set_bone_pose_scale<class_Skeleton3D_method_set_bone_pose_scale>` **(** :ref:`int<class_int>` bone_idx, :ref:`Vector3<class_Vector3>` scale **)** |
  115. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | void | :ref:`set_bone_rest<class_Skeleton3D_method_set_bone_rest>` **(** :ref:`int<class_int>` bone_idx, :ref:`Transform3D<class_Transform3D>` rest **)** |
  117. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | void | :ref:`unparent_bone_and_rest<class_Skeleton3D_method_unparent_bone_and_rest>` **(** :ref:`int<class_int>` bone_idx **)** |
  119. +-------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. .. rst-class:: classref-section-separator
  121. ----
  122. .. rst-class:: classref-descriptions-group
  123. Signals
  124. -------
  125. .. _class_Skeleton3D_signal_bone_enabled_changed:
  126. .. rst-class:: classref-signal
  127. **bone_enabled_changed** **(** :ref:`int<class_int>` bone_idx **)**
  128. Emitted when the bone at ``bone_idx`` is toggled with :ref:`set_bone_enabled<class_Skeleton3D_method_set_bone_enabled>`. Use :ref:`is_bone_enabled<class_Skeleton3D_method_is_bone_enabled>` to check the new value.
  129. .. rst-class:: classref-item-separator
  130. ----
  131. .. _class_Skeleton3D_signal_bone_pose_changed:
  132. .. rst-class:: classref-signal
  133. **bone_pose_changed** **(** :ref:`int<class_int>` bone_idx **)**
  134. This signal is emitted when one of the bones in the Skeleton3D node have changed their pose. This is used to inform nodes that rely on bone positions that one of the bones in the Skeleton3D have changed their transform/pose.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_Skeleton3D_signal_pose_updated:
  138. .. rst-class:: classref-signal
  139. **pose_updated** **(** **)**
  140. Emitted when the pose is updated, after :ref:`NOTIFICATION_UPDATE_SKELETON<class_Skeleton3D_constant_NOTIFICATION_UPDATE_SKELETON>` is received.
  141. .. rst-class:: classref-item-separator
  142. ----
  143. .. _class_Skeleton3D_signal_show_rest_only_changed:
  144. .. rst-class:: classref-signal
  145. **show_rest_only_changed** **(** **)**
  146. Emitted when the value of :ref:`show_rest_only<class_Skeleton3D_property_show_rest_only>` changes.
  147. .. rst-class:: classref-section-separator
  148. ----
  149. .. rst-class:: classref-descriptions-group
  150. Constants
  151. ---------
  152. .. _class_Skeleton3D_constant_NOTIFICATION_UPDATE_SKELETON:
  153. .. rst-class:: classref-constant
  154. **NOTIFICATION_UPDATE_SKELETON** = ``50``
  155. Notification received when this skeleton's pose needs to be updated.
  156. This notification is received *before* the related :ref:`pose_updated<class_Skeleton3D_signal_pose_updated>` signal.
  157. .. rst-class:: classref-section-separator
  158. ----
  159. .. rst-class:: classref-descriptions-group
  160. Property Descriptions
  161. ---------------------
  162. .. _class_Skeleton3D_property_animate_physical_bones:
  163. .. rst-class:: classref-property
  164. :ref:`bool<class_bool>` **animate_physical_bones** = ``true``
  165. .. rst-class:: classref-property-setget
  166. - void **set_animate_physical_bones** **(** :ref:`bool<class_bool>` value **)**
  167. - :ref:`bool<class_bool>` **get_animate_physical_bones** **(** **)**
  168. .. container:: contribute
  169. There is currently no description for this property. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_Skeleton3D_property_motion_scale:
  173. .. rst-class:: classref-property
  174. :ref:`float<class_float>` **motion_scale** = ``1.0``
  175. .. rst-class:: classref-property-setget
  176. - void **set_motion_scale** **(** :ref:`float<class_float>` value **)**
  177. - :ref:`float<class_float>` **get_motion_scale** **(** **)**
  178. Multiplies the 3D position track animation.
  179. \ **Note:** Unless this value is ``1.0``, the key value in animation will not match the actual position value.
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_Skeleton3D_property_show_rest_only:
  183. .. rst-class:: classref-property
  184. :ref:`bool<class_bool>` **show_rest_only** = ``false``
  185. .. rst-class:: classref-property-setget
  186. - void **set_show_rest_only** **(** :ref:`bool<class_bool>` value **)**
  187. - :ref:`bool<class_bool>` **is_show_rest_only** **(** **)**
  188. 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.
  189. .. rst-class:: classref-section-separator
  190. ----
  191. .. rst-class:: classref-descriptions-group
  192. Method Descriptions
  193. -------------------
  194. .. _class_Skeleton3D_method_add_bone:
  195. .. rst-class:: classref-method
  196. void **add_bone** **(** :ref:`String<class_String>` name **)**
  197. Adds a bone, with name ``name``. :ref:`get_bone_count<class_Skeleton3D_method_get_bone_count>` will become the bone index.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_Skeleton3D_method_clear_bones:
  201. .. rst-class:: classref-method
  202. void **clear_bones** **(** **)**
  203. Clear all the bones in this skeleton.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_Skeleton3D_method_clear_bones_global_pose_override:
  207. .. rst-class:: classref-method
  208. void **clear_bones_global_pose_override** **(** **)**
  209. Removes the global pose override on all bones in the skeleton.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_Skeleton3D_method_create_skin_from_rest_transforms:
  213. .. rst-class:: classref-method
  214. :ref:`Skin<class_Skin>` **create_skin_from_rest_transforms** **(** **)**
  215. .. container:: contribute
  216. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_Skeleton3D_method_find_bone:
  220. .. rst-class:: classref-method
  221. :ref:`int<class_int>` **find_bone** **(** :ref:`String<class_String>` name **)** |const|
  222. Returns the bone index that matches ``name`` as its name.
  223. .. rst-class:: classref-item-separator
  224. ----
  225. .. _class_Skeleton3D_method_force_update_all_bone_transforms:
  226. .. rst-class:: classref-method
  227. void **force_update_all_bone_transforms** **(** **)**
  228. Force updates the bone transforms/poses for all bones in the skeleton.
  229. \ *Deprecated.* Do not use.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_Skeleton3D_method_force_update_bone_child_transform:
  233. .. rst-class:: classref-method
  234. void **force_update_bone_child_transform** **(** :ref:`int<class_int>` bone_idx **)**
  235. Force updates the bone transform for the bone at ``bone_idx`` and all of its children.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_Skeleton3D_method_get_bone_children:
  239. .. rst-class:: classref-method
  240. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_bone_children** **(** :ref:`int<class_int>` bone_idx **)** |const|
  241. Returns an array containing the bone indexes of all the child node of the passed in bone, ``bone_idx``.
  242. .. rst-class:: classref-item-separator
  243. ----
  244. .. _class_Skeleton3D_method_get_bone_count:
  245. .. rst-class:: classref-method
  246. :ref:`int<class_int>` **get_bone_count** **(** **)** |const|
  247. Returns the number of bones in the skeleton.
  248. .. rst-class:: classref-item-separator
  249. ----
  250. .. _class_Skeleton3D_method_get_bone_global_pose:
  251. .. rst-class:: classref-method
  252. :ref:`Transform3D<class_Transform3D>` **get_bone_global_pose** **(** :ref:`int<class_int>` bone_idx **)** |const|
  253. 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.
  254. .. rst-class:: classref-item-separator
  255. ----
  256. .. _class_Skeleton3D_method_get_bone_global_pose_no_override:
  257. .. rst-class:: classref-method
  258. :ref:`Transform3D<class_Transform3D>` **get_bone_global_pose_no_override** **(** :ref:`int<class_int>` bone_idx **)** |const|
  259. 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.
  260. .. rst-class:: classref-item-separator
  261. ----
  262. .. _class_Skeleton3D_method_get_bone_global_pose_override:
  263. .. rst-class:: classref-method
  264. :ref:`Transform3D<class_Transform3D>` **get_bone_global_pose_override** **(** :ref:`int<class_int>` bone_idx **)** |const|
  265. Returns the global pose override transform for ``bone_idx``.
  266. .. rst-class:: classref-item-separator
  267. ----
  268. .. _class_Skeleton3D_method_get_bone_global_rest:
  269. .. rst-class:: classref-method
  270. :ref:`Transform3D<class_Transform3D>` **get_bone_global_rest** **(** :ref:`int<class_int>` bone_idx **)** |const|
  271. Returns the global rest transform for ``bone_idx``.
  272. .. rst-class:: classref-item-separator
  273. ----
  274. .. _class_Skeleton3D_method_get_bone_name:
  275. .. rst-class:: classref-method
  276. :ref:`String<class_String>` **get_bone_name** **(** :ref:`int<class_int>` bone_idx **)** |const|
  277. Returns the name of the bone at index ``bone_idx``.
  278. .. rst-class:: classref-item-separator
  279. ----
  280. .. _class_Skeleton3D_method_get_bone_parent:
  281. .. rst-class:: classref-method
  282. :ref:`int<class_int>` **get_bone_parent** **(** :ref:`int<class_int>` bone_idx **)** |const|
  283. Returns the bone index which is the parent of the bone at ``bone_idx``. If -1, then bone has no parent.
  284. \ **Note:** The parent bone returned will always be less than ``bone_idx``.
  285. .. rst-class:: classref-item-separator
  286. ----
  287. .. _class_Skeleton3D_method_get_bone_pose:
  288. .. rst-class:: classref-method
  289. :ref:`Transform3D<class_Transform3D>` **get_bone_pose** **(** :ref:`int<class_int>` bone_idx **)** |const|
  290. Returns the pose transform of the specified bone.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_Skeleton3D_method_get_bone_pose_position:
  294. .. rst-class:: classref-method
  295. :ref:`Vector3<class_Vector3>` **get_bone_pose_position** **(** :ref:`int<class_int>` bone_idx **)** |const|
  296. Returns the pose position of the bone at ``bone_idx``. The returned :ref:`Vector3<class_Vector3>` is in the local coordinate space of the **Skeleton3D** node.
  297. .. rst-class:: classref-item-separator
  298. ----
  299. .. _class_Skeleton3D_method_get_bone_pose_rotation:
  300. .. rst-class:: classref-method
  301. :ref:`Quaternion<class_Quaternion>` **get_bone_pose_rotation** **(** :ref:`int<class_int>` bone_idx **)** |const|
  302. Returns the pose rotation of the bone at ``bone_idx``. The returned :ref:`Quaternion<class_Quaternion>` is local to the bone with respect to the rotation of any parent bones.
  303. .. rst-class:: classref-item-separator
  304. ----
  305. .. _class_Skeleton3D_method_get_bone_pose_scale:
  306. .. rst-class:: classref-method
  307. :ref:`Vector3<class_Vector3>` **get_bone_pose_scale** **(** :ref:`int<class_int>` bone_idx **)** |const|
  308. Returns the pose scale of the bone at ``bone_idx``.
  309. .. rst-class:: classref-item-separator
  310. ----
  311. .. _class_Skeleton3D_method_get_bone_rest:
  312. .. rst-class:: classref-method
  313. :ref:`Transform3D<class_Transform3D>` **get_bone_rest** **(** :ref:`int<class_int>` bone_idx **)** |const|
  314. Returns the rest transform for a bone ``bone_idx``.
  315. .. rst-class:: classref-item-separator
  316. ----
  317. .. _class_Skeleton3D_method_get_parentless_bones:
  318. .. rst-class:: classref-method
  319. :ref:`PackedInt32Array<class_PackedInt32Array>` **get_parentless_bones** **(** **)** |const|
  320. 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.
  321. .. rst-class:: classref-item-separator
  322. ----
  323. .. _class_Skeleton3D_method_get_version:
  324. .. rst-class:: classref-method
  325. :ref:`int<class_int>` **get_version** **(** **)** |const|
  326. Returns the number of times the bone hierarchy has changed within this skeleton, including renames.
  327. The Skeleton version is not serialized: only use within a single instance of Skeleton3D.
  328. Use for invalidating caches in IK solvers and other nodes which process bones.
  329. .. rst-class:: classref-item-separator
  330. ----
  331. .. _class_Skeleton3D_method_is_bone_enabled:
  332. .. rst-class:: classref-method
  333. :ref:`bool<class_bool>` **is_bone_enabled** **(** :ref:`int<class_int>` bone_idx **)** |const|
  334. Returns whether the bone pose for the bone at ``bone_idx`` is enabled.
  335. .. rst-class:: classref-item-separator
  336. ----
  337. .. _class_Skeleton3D_method_localize_rests:
  338. .. rst-class:: classref-method
  339. void **localize_rests** **(** **)**
  340. Returns all bones in the skeleton to their rest poses.
  341. .. rst-class:: classref-item-separator
  342. ----
  343. .. _class_Skeleton3D_method_physical_bones_add_collision_exception:
  344. .. rst-class:: classref-method
  345. void **physical_bones_add_collision_exception** **(** :ref:`RID<class_RID>` exception **)**
  346. Adds a collision exception to the physical bone.
  347. Works just like the :ref:`RigidBody3D<class_RigidBody3D>` node.
  348. .. rst-class:: classref-item-separator
  349. ----
  350. .. _class_Skeleton3D_method_physical_bones_remove_collision_exception:
  351. .. rst-class:: classref-method
  352. void **physical_bones_remove_collision_exception** **(** :ref:`RID<class_RID>` exception **)**
  353. Removes a collision exception to the physical bone.
  354. Works just like the :ref:`RigidBody3D<class_RigidBody3D>` node.
  355. .. rst-class:: classref-item-separator
  356. ----
  357. .. _class_Skeleton3D_method_physical_bones_start_simulation:
  358. .. rst-class:: classref-method
  359. void **physical_bones_start_simulation** **(** :ref:`StringName[]<class_StringName>` bones=[] **)**
  360. Tells the :ref:`PhysicalBone3D<class_PhysicalBone3D>` nodes in the Skeleton to start simulating and reacting to the physics world.
  361. Optionally, a list of bone names can be passed-in, allowing only the passed-in bones to be simulated.
  362. .. rst-class:: classref-item-separator
  363. ----
  364. .. _class_Skeleton3D_method_physical_bones_stop_simulation:
  365. .. rst-class:: classref-method
  366. void **physical_bones_stop_simulation** **(** **)**
  367. Tells the :ref:`PhysicalBone3D<class_PhysicalBone3D>` nodes in the Skeleton to stop simulating.
  368. .. rst-class:: classref-item-separator
  369. ----
  370. .. _class_Skeleton3D_method_register_skin:
  371. .. rst-class:: classref-method
  372. :ref:`SkinReference<class_SkinReference>` **register_skin** **(** :ref:`Skin<class_Skin>` skin **)**
  373. Binds the given Skin to the Skeleton.
  374. .. rst-class:: classref-item-separator
  375. ----
  376. .. _class_Skeleton3D_method_reset_bone_pose:
  377. .. rst-class:: classref-method
  378. void **reset_bone_pose** **(** :ref:`int<class_int>` bone_idx **)**
  379. Sets the bone pose to rest for ``bone_idx``.
  380. .. rst-class:: classref-item-separator
  381. ----
  382. .. _class_Skeleton3D_method_reset_bone_poses:
  383. .. rst-class:: classref-method
  384. void **reset_bone_poses** **(** **)**
  385. Sets all bone poses to rests.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_Skeleton3D_method_set_bone_enabled:
  389. .. rst-class:: classref-method
  390. void **set_bone_enabled** **(** :ref:`int<class_int>` bone_idx, :ref:`bool<class_bool>` enabled=true **)**
  391. Disables the pose for the bone at ``bone_idx`` if ``false``, enables the bone pose if ``true``.
  392. .. rst-class:: classref-item-separator
  393. ----
  394. .. _class_Skeleton3D_method_set_bone_global_pose_override:
  395. .. rst-class:: classref-method
  396. void **set_bone_global_pose_override** **(** :ref:`int<class_int>` bone_idx, :ref:`Transform3D<class_Transform3D>` pose, :ref:`float<class_float>` amount, :ref:`bool<class_bool>` persistent=false **)**
  397. Sets the global pose transform, ``pose``, for the bone at ``bone_idx``.
  398. \ ``amount`` is the interpolation strength that will be used when applying the pose, and ``persistent`` determines if the applied pose will remain.
  399. \ **Note:** The pose transform needs to be a global pose! To convert a world transform from a :ref:`Node3D<class_Node3D>` to a global bone pose, multiply the :ref:`Transform3D.affine_inverse<class_Transform3D_method_affine_inverse>` of the node's :ref:`Node3D.global_transform<class_Node3D_property_global_transform>` by the desired world transform.
  400. .. rst-class:: classref-item-separator
  401. ----
  402. .. _class_Skeleton3D_method_set_bone_name:
  403. .. rst-class:: classref-method
  404. void **set_bone_name** **(** :ref:`int<class_int>` bone_idx, :ref:`String<class_String>` name **)**
  405. .. container:: contribute
  406. There is currently no description for this method. Please help us by :ref:`contributing one <doc_updating_the_class_reference>`!
  407. .. rst-class:: classref-item-separator
  408. ----
  409. .. _class_Skeleton3D_method_set_bone_parent:
  410. .. rst-class:: classref-method
  411. void **set_bone_parent** **(** :ref:`int<class_int>` bone_idx, :ref:`int<class_int>` parent_idx **)**
  412. Sets the bone index ``parent_idx`` as the parent of the bone at ``bone_idx``. If -1, then bone has no parent.
  413. \ **Note:** ``parent_idx`` must be less than ``bone_idx``.
  414. .. rst-class:: classref-item-separator
  415. ----
  416. .. _class_Skeleton3D_method_set_bone_pose_position:
  417. .. rst-class:: classref-method
  418. void **set_bone_pose_position** **(** :ref:`int<class_int>` bone_idx, :ref:`Vector3<class_Vector3>` position **)**
  419. Sets the pose position of the bone at ``bone_idx`` to ``position``. ``position`` is a :ref:`Vector3<class_Vector3>` describing a position local to the **Skeleton3D** node.
  420. .. rst-class:: classref-item-separator
  421. ----
  422. .. _class_Skeleton3D_method_set_bone_pose_rotation:
  423. .. rst-class:: classref-method
  424. void **set_bone_pose_rotation** **(** :ref:`int<class_int>` bone_idx, :ref:`Quaternion<class_Quaternion>` rotation **)**
  425. Sets the pose rotation of the bone at ``bone_idx`` to ``rotation``. ``rotation`` is a :ref:`Quaternion<class_Quaternion>` describing a rotation in the bone's local coordinate space with respect to the rotation of any parent bones.
  426. .. rst-class:: classref-item-separator
  427. ----
  428. .. _class_Skeleton3D_method_set_bone_pose_scale:
  429. .. rst-class:: classref-method
  430. void **set_bone_pose_scale** **(** :ref:`int<class_int>` bone_idx, :ref:`Vector3<class_Vector3>` scale **)**
  431. Sets the pose scale of the bone at ``bone_idx`` to ``scale``.
  432. .. rst-class:: classref-item-separator
  433. ----
  434. .. _class_Skeleton3D_method_set_bone_rest:
  435. .. rst-class:: classref-method
  436. void **set_bone_rest** **(** :ref:`int<class_int>` bone_idx, :ref:`Transform3D<class_Transform3D>` rest **)**
  437. Sets the rest transform for bone ``bone_idx``.
  438. .. rst-class:: classref-item-separator
  439. ----
  440. .. _class_Skeleton3D_method_unparent_bone_and_rest:
  441. .. rst-class:: classref-method
  442. void **unparent_bone_and_rest** **(** :ref:`int<class_int>` bone_idx **)**
  443. Unparents the bone at ``bone_idx`` and sets its rest position to that of its parent prior to being reset.
  444. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  445. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  446. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  447. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  448. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  449. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  450. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`