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...
BoneTwistDisperser3D
繼承: SkeletonModifier3D < Node3D < Node < Object
將子骨骼的扭轉傳播並分散到其父骨骼上的節點。
說明
此 BoneTwistDisperser3D 節點通過將末端骨骼的扭轉分散到父骨骼,來實現多個骨骼間的平滑扭轉插值。它只會改變扭轉角度,而不會改變每個關節的全域位置。
與 CopyTransformModifier3D 和反向動力學(IK)結合使用時,可用於實現骨骼的平滑扭轉效果。
注意:如果提取的扭轉角度超過 180 度,則會發生翻轉。這一點與 ConvertTransformModifier3D 類似。
注意:該類中的大多數方法都接受一個 index 參數。如果 IK 包含多個條目(例如 settings/<index>/root_bone_name),則該參數用於指定應回傳哪個設定清單條目。
屬性
|
||
|
方法
列舉
enum DisperseMode: 🔗
DisperseMode DISPERSE_MODE_EVEN = 0
分配數值,使其從 0.0 到 1.0 單調遞增,並確保所有權重相等。例如,如果有五個關節,從根骨骼開始的數值將依次為 0.2、0.4、0.6、0.8 和 1.0。
DisperseMode DISPERSE_MODE_WEIGHTED = 1
根據關節節段之間骨骼的長度,分配數值,使其從 0.0 單調遞增到 1.0。另見 set_weight_position()。
DisperseMode DISPERSE_MODE_CUSTOM = 2
可以為關節清單分配任意值。另見 set_joint_twist_amount()。
當 is_end_bone_extended() 為 false 時,參考骨骼的子骨骼僅用於確定扭轉軸,因此其自訂量完全沒有效果。
屬性說明
bool mutable_bone_axes = true 🔗
如果為 true,則求解器每影格從骨骼姿態中檢索骨骼軸。
如果為 false,則求解器將從骨骼放鬆中檢索骨骼軸並將其快取。
設定的數量。
方法說明
void clear_settings() 🔗
清空所有設定。
Curve get_damping_curve(index: int) const 🔗
當 get_disperse_mode() 的值為 DISPERSE_MODE_CUSTOM 時,回傳阻尼曲線。
DisperseMode get_disperse_mode(index: int) const 🔗
回傳是使用自動分配還是允許手動分配。
int get_end_bone(index: int) const 🔗
回傳骨骼鏈末尾骨骼的索引。
BoneDirection get_end_bone_direction(index: int) const 🔗
當 is_end_bone_extended() 為 true 時,回傳骨骼鏈末端骨骼的尾部方向。
String get_end_bone_name(index: int) const 🔗
回傳骨骼鏈末尾骨骼的名稱。
int get_joint_bone(index: int, joint: int) const 🔗
回傳骨骼鏈關節清單中位於 joint 的骨骼的索引。
String get_joint_bone_name(index: int, joint: int) const 🔗
回傳骨骼鏈關節清單中位於 joint 的骨骼的名稱。
int get_joint_count(index: int) const 🔗
回傳骨骼鏈關節清單中的關節數量。
float get_joint_twist_amount(index: int, joint: int) const 🔗
當 get_disperse_mode() 為 DISPERSE_MODE_CUSTOM 時,回傳骨骼鏈關節清單中 joint 處的扭轉量。
int get_reference_bone(index: int) const 🔗
回傳參考骨骼,以提取 index 處的設定項的扭曲。
根據 is_end_bone_extended(),該骨骼要麼是鏈的末端,要麼是它的父級。
String get_reference_bone_name(index: int) const 🔗
回傳參考骨骼名稱,以提取 index 處的設定項的扭曲。
根據 is_end_bone_extended(),該骨骼要麼是鏈的末端,要麼是它的父級。
int get_root_bone(index: int) const 🔗
回傳骨骼鏈根骨骼的索引。
String get_root_bone_name(index: int) const 🔗
回傳骨骼鏈根骨骼的名稱。
Quaternion get_twist_from(index: int) const 🔗
當 is_twist_from_rest() 為 false 時,回傳目前骨骼姿勢在扭轉之前恢復到任意狀態時的旋轉,以便提取扭轉角度。
float get_weight_position(index: int) const 🔗
回傳當 get_disperse_mode() 為 DISPERSE_MODE_WEIGHTED 時,在關節之間分割線段以進行權重分配的位置。
bool is_end_bone_extended(index: int) const 🔗
如果末端骨骼被擴充形成尾部,則回傳 true。
bool is_twist_from_rest(index: int) const 🔗
如果能夠從骨骼放鬆姿勢和目前骨骼姿勢之間的差異中提取扭轉量,則回傳 true。
void set_damping_curve(index: int, curve: Curve) 🔗
當 get_disperse_mode() 為 DISPERSE_MODE_CUSTOM 時,用於設定阻尼曲線。
void set_disperse_mode(index: int, disperse_mode: DisperseMode) 🔗
設定是使用自動分配還是允許手動分配。
void set_end_bone(index: int, bone: int) 🔗
設定骨骼鏈中末端骨骼的索引。
void set_end_bone_direction(index: int, bone_direction: BoneDirection) 🔗
當 is_end_bone_extended() 為 true 時,設定骨骼鏈中末端骨骼的尾部方向。
void set_end_bone_name(index: int, bone_name: String) 🔗
設定骨骼鏈的末端骨骼名稱。
注意:末端骨骼必須是根骨骼的子骨骼。
void set_extend_end_bone(index: int, enabled: bool) 🔗
如果 enabled 為 true,則會延伸末端骨骼形成尾部。
如果 enabled 為 false,則 get_reference_bone() 會成為末端骨骼的父骨骼,並使用到末端骨骼的向量作為扭轉軸。
void set_joint_twist_amount(index: int, joint: int, twist_amount: float) 🔗
當 get_disperse_mode() 為 DISPERSE_MODE_CUSTOM 時,設定骨骼鏈關節清單中 joint 處的扭轉量。
void set_root_bone(index: int, bone: int) 🔗
設定骨骼鏈中根骨骼的索引。
void set_root_bone_name(index: int, bone_name: String) 🔗
設定骨骼鏈中根骨骼的名稱。
void set_twist_from(index: int, from: Quaternion) 🔗
在扭轉目前骨骼姿勢之前,將旋轉設定為任意狀態,以便在 is_twist_from_rest() 為 false 時提取扭轉。
換言之,通過對特定 SkeletonModifier3D 的 SkeletonModifier3D.modification_processed 呼叫 set_twist_from(),可以僅提取在該 BoneTwistDisperser3D 之前處理的修改器生成的扭轉。
void set_twist_from_rest(index: int, enabled: bool) 🔗
如果 enabled 為 true,則從骨骼放鬆姿勢和目前骨骼姿勢之間的差異中提取扭轉量。
如果 enabled 為 false,則從 get_twist_from() 和目前骨骼姿勢之間的差異中提取扭轉量。另見 set_twist_from()。
void set_weight_position(index: int, weight_position: float) 🔗
當 get_disperse_mode() 的值為 DISPERSE_MODE_WEIGHTED 時,設定在關節之間分割線段以進行權重分配的位置。
例如,當 weight_position 為 0.5 時,如果三個關節之間存在兩段長度為 1.0 的骨骼,則從根關節到末端關節,每個關節的權重分配比例分別為 0.5、1.0 和 0.5。然後,最終的權重值將分別變為 0.25、0.75 和 1.0。