Fix the Quaternius side swap, arm swing axis, and hand-proxy position (backward-compatible)
Full build / Import + headless tests (push) Successful in 45s
Full build / Full desktop build + optional release (push) Skipped

This commit is contained in:
zwitschi committed 2026-11-06 12:17:18 +01:00
1 parent bb54ef3eec
commit 2a6f29f5d0
1 file changed
+15 -11
+15 -11
View File
@@ -420,27 +420,31 @@ func _build_skinned_body(npc_type: int) -> bool:
_rig.add_child(_head)
for side in [-1.0, 1.0]:
var suffix := "L" if side < 0.0 else "R"
# The Quaternius rig labels its joints with the opposite side (its "L" sits
# at +x while the project's "L" sits at −x), so the dot-suffixed names are
# looked up with a swapped suffix.
var qsuffix := "R" if side < 0.0 else "L"
var hip := Node3D.new()
hip.name = "Hip" + suffix
hip.position = _rest_origin(["Hip" + suffix, "UpperLeg." + suffix])
hip.position = _rest_origin(["Hip" + suffix, "UpperLeg." + qsuffix])
_rig.add_child(hip)
var knee := Node3D.new()
knee.name = "Knee"
knee.position = _rest_origin(["Knee" + suffix, "LowerLeg." + suffix]) - hip.position
knee.position = _rest_origin(["Knee" + suffix, "LowerLeg." + qsuffix]) - hip.position
hip.add_child(knee)
_legs.append(hip)
_knees.append(knee)
var shoulder := Node3D.new()
shoulder.name = "Shoulder" + suffix
shoulder.position = _rest_origin(["Shoulder" + suffix, "UpperArm." + suffix])
shoulder.position = _rest_origin(["Shoulder" + suffix, "UpperArm." + qsuffix])
_rig.add_child(shoulder)
var elbow := Node3D.new()
elbow.name = "Elbow"
elbow.position = _rest_origin(["Elbow" + suffix, "LowerArm." + suffix]) - shoulder.position
elbow.position = _rest_origin(["Elbow" + suffix, "LowerArm." + qsuffix]) - shoulder.position
shoulder.add_child(elbow)
var hand := Node3D.new()
hand.name = "Hand"
hand.position = _rest_origin(["Hand" + suffix, "Wrist." + suffix]) - elbow.position
hand.position = _rest_origin(["Hand" + suffix, "Wrist." + qsuffix]) - _rest_origin(["Elbow" + suffix, "LowerArm." + qsuffix])
elbow.add_child(hand)
_arms.append(shoulder)
_elbows.append(elbow)
@@ -514,21 +518,21 @@ func _sync_skeleton() -> void:
if _skeleton == null or _bone_indices.is_empty():
return
for i in 2:
_pose_bone_any(["UpperLeg.L", "HipL"], ["UpperLeg.R", "HipR"], i, _legs[i].rotation.x)
_pose_bone_any(["UpperLeg.R", "HipL"], ["UpperLeg.L", "HipR"], i, _legs[i].rotation.x)
for i in 2:
_pose_bone_any(["LowerLeg.L", "KneeL"], ["LowerLeg.R", "KneeR"], i, _knees[i].rotation.x)
_pose_bone_any(["LowerLeg.R", "KneeL"], ["LowerLeg.L", "KneeR"], i, _knees[i].rotation.x)
for i in 2:
_pose_bone_any(["UpperArm.L", "ShoulderL"], ["UpperArm.R", "ShoulderR"], i, _arms[i].rotation.x)
_pose_bone_any(["UpperArm.R", "ShoulderL"], ["UpperArm.L", "ShoulderR"], i, _arms[i].rotation.x, Vector3.LEFT)
for i in 2:
_pose_bone_any(["LowerArm.L", "ElbowL"], ["LowerArm.R", "ElbowR"], i, _elbows[i].rotation.x)
_pose_bone_any(["LowerArm.R", "ElbowL"], ["LowerArm.L", "ElbowR"], i, _elbows[i].rotation.x, Vector3.LEFT)
if _head != null:
_pose_bone("Head", _head.rotation.y, Vector3.UP)
func _pose_bone_any(left: Array, right: Array, index: int, angle: float) -> void:
func _pose_bone_any(left: Array, right: Array, index: int, angle: float, axis: Vector3 = Vector3.RIGHT) -> void:
var names: Array = left if index == 0 else right
for bone_name in names:
if _bone_indices.has(bone_name):
_pose_bone(bone_name, angle, Vector3.RIGHT)
_pose_bone(bone_name, angle, axis)
return
func _pose_bone(bone_name: String, angle: float, axis: Vector3) -> void: