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...
3D 骨架動畫重定向
重定向可用選項
骨骼對應(Bone Map)
在場景進階匯入設定選擇 Skeleton3D 節點時,右邊會出現「重定向」區塊,裡面有一個 bone_map 屬性。
選取 Skeleton 節點後,先建立一份新的 BoneMap 與 SkeletonProfile 。Godot 內建 SkeletonProfileHumanoid (人形骨架 Profile)可直接用於 SkeletonProfileHumanoid ,本教學以下以此為例。
備註
如果你需要的骨架 profile 跟 SkeletonProfileHumanoid 不同,可以在 Godot 編輯器選 Skeleton3D 後,從 3D 視窗工具列的 Skeleton3D 選單匯出自訂 SkeletonProfile。
當您使用 SkeletonProfileHumanoid 時,當 SkeletonProfile 設定時將會自動進行對應。如果自動對應效果不佳,您可以手動對應骨骼。
如果有骨頭沒對應、重複對應、或父子階層不正確,會在面板顯示洋紅色或紅色警示(依編輯器配色)。這不會擋下匯入,但代表動畫可能無法正常共用。
備註
自動對應是靠骨頭名稱的模式比對,所以建議骨頭名稱用常見英文命名規則。
設定好 bone_map 後,下方會有更多細部選項可調整。
移除動畫軌道
如果你要把動畫匯入成 AnimationLibrary 來共用,建議開啟這些選項。若是匯入場景(Scene)用,有時建議關掉,像角色有附加動畫配件時,開啟這些選項可能會讓配件不會動。
只保留骨架變換(Except Bone Transform)
移除所有非骨架 Transform(位置/旋轉/縮放)軌道,只留下骨架動畫。
忽略非必要位移軌道
Removes Position tracks other than root_bone and scale_base_bone
defined in SkeletonProfile from the animations. In SkeletonProfileHumanoid,
this means that to remove Position tracks other than "Root" and "Hips".
Since Godot 4, animations include Bone Rest in the Transform value. If you disable this option,
the animation may change the body shape unpredictably.
未對應骨頭
移除所有沒有對應到骨架 Profile 的骨頭動畫軌道。
骨頭自動命名
重新命名骨頭
會自動把已對應的骨頭重新命名。
唯一節點命名
將 Skeleton 節點命名為你指定的 skeleton_name,讓動畫路徑(NodePath)無論場景階層如何都能對應正確。
Rest 修正器
SkeletonProfileHumanoid 預設參考姿勢有以下規則:
人形骨架採 T-Pose
人形朝 +Z(Godot 右手 Y-Up)方向
人形骨架節點本身不該有 Transform
+Y 軸方向從父骨頭指向子骨頭
+X 旋轉代表彎曲(像收縮肌肉)
這些規則是為了混合動畫與反解(IK)方便。如果模型不符這些規則,建議用下列選項修正。
套用節點變換
有些資源匯出沒特別處理時,Skeleton 節點本身會帶 Transform(例如 Blender 匯出 glTF 沒有 Apply Transform)。看起來模型方向正確,但骨架內部實際 Transform 跟標準不同。這選項會在匯入時直接把 Transform 套進骨架,修正這問題。
備註
若場景裡有骨架以外的物件,開這選項有可能出現其他問題。
標準化位移軌道
Position 軌道多半用於角色移動,但如果不同身高的模型共用同一套動畫,移動距離/步幅會出現滑動感。這選項會根據 scale_base_bone``(通常是 Hips)的高度自動標準化位移,Skeleton 會記錄 ``motion_scale,播放時會自動依比例調整。關掉這選項時,Position 軌道不會標準化,motion_scale 會固定為 1.0。
在 SkeletonProfileHumanoid 預設下,scale_base_bone 就是「Hips」,所以 motion_scale 會用 Hips 高度計算。
覆寫軸向
透過覆寫模型的骨骼靜態姿勢,以符合定義在 SkeletonProfile 中的參考姿勢。
備註
This is the most important option for sharing animations in Godot 4, but be aware that this option can produce horrible results if the original Bone Rest set externally is important. If you want to share animations with keeping the original Bone Rest, consider to use the Realtime Retarget Module.
修正外型(Silhouette)
嘗試使模型的輪廓符合定義在 SkeletonProfile 中的參考姿勢,例如 T 型姿勢。這無法修正差異過大的輪廓,且可能無法用於修正骨骼捲動。
若使用 SkeletonProfileHumanoid ,T-pose 模型不需啟用此選項,但 A-pose 模型則應啟用。不過這種情況下,固定腳部的結果可能因模型的腳跟高度而不佳,因此可能需要將不希望固定 SkeletonProfile 的骨骼名稱加到 filter 陣列(如下例)。
如果角色膝蓋或腳掌本來就彎曲,可能要調整 scale_base_bone 的高度,可用 base_height_adjustment 參數調整。