Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
Skeleton2D
繼承: Node2D < CanvasItem < Node < Object
Bone2D 層級結構的父節點,用於建立 2D 骨骼動畫。
說明
Skeleton2D 是 Bone2D 節點層級結構的父節點,持有對每個 Bone2D 的放鬆姿勢的引用,充當其骨骼的單一存取點。
要為給定的 Skeleton2D 設定不同型別的反向運動學機制,應當建立一個 SkeletonModificationStack2D。增加 SkeletonModificationStack2D.modification_count 並建立所需數量的修改器即可套用反向運動學機制。
教學
方法
void |
execute_modifications(delta: float, execution_mode: int) |
get_bone_count() const |
|
get_bone_local_pose_override(bone_idx: int) |
|
get_modification_stack() const |
|
get_skeleton() const |
|
void |
set_bone_local_pose_override(bone_idx: int, override_pose: Transform2D, strength: float, persistent: bool) |
void |
set_modification_stack(modification_stack: SkeletonModificationStack2D) |
訊號
bone_setup_changed() 🔗
當附加到該骨架的 Bone2D 設定更改時發出。這主要在骨架內部使用。
方法說明
void execute_modifications(delta: float, execution_mode: int) 🔗
如果該 Skeleton2D 分配有 SkeletonModificationStack2D,則執行其中的所有修改。
從由 Skeleton2D 為父節點的節點層次結構中返回 Bone2D。要返回的對象由參數 idx 標識。骨骼通過從上到下降低節點層次結構來索引,在移動到下一個兄弟節點之前新增每個分支的子節點。
返回由 Skeleton2D 為父節點的節點層次結構中 Bone2D 節點的數量。
Transform2D get_bone_local_pose_override(bone_idx: int) 🔗
返回骨骼 bone_idx 的局部姿勢覆蓋變換。
SkeletonModificationStack2D get_modification_stack() const 🔗
如果存在,則返回附加到此骨架的 SkeletonModificationStack2D。
返回 Skeleton2D 實例的 RID。
void set_bone_local_pose_override(bone_idx: int, override_pose: Transform2D, strength: float, persistent: bool) 🔗
為 bone_idx 處的骨骼設定局部姿勢變換 override_pose。
strength 是套用姿勢時將使用的插值強度,persistent 決定是否會保持套用的姿勢。
注意:姿勢變換需要是相對於 bone_idx 處的 Bone2D 節點的局部變換!
void set_modification_stack(modification_stack: SkeletonModificationStack2D) 🔗
設定附加到此骨架的 SkeletonModificationStack2D。