feat: Refactor head transformation logic and update driver paths for pivot integration
This commit is contained in:
+10
-6
@@ -271,13 +271,17 @@ func _apply_profile() -> void:
|
||||
facing_profile_changed.emit(int(facing_profile))
|
||||
|
||||
func _apply_head_flip() -> void:
|
||||
if _body_container == null:
|
||||
return
|
||||
var head := _body_container.get_node_or_null("Head") as Node2D
|
||||
if head != null:
|
||||
var head := get_node_or_null("Skeleton2D/Torso/Head") as Node2D
|
||||
var pivot := get_node_or_null("Skeleton2D/Torso/Head/Pivot") as Node2D
|
||||
if pivot != null:
|
||||
var is_left := (facing_profile == FacingProfile.LEFT)
|
||||
# Keep local X positive (neck upright), invert local Y (mirror brim & face)
|
||||
head.scale = Vector2(1.0, -1.0) if is_left else Vector2(1.0, 1.0)
|
||||
if is_left:
|
||||
# Mirror local X and invert double the bone's rotation to mirror in world space
|
||||
pivot.scale = Vector2(-1.0, 1.0)
|
||||
pivot.rotation = -1.0 * head.rotation
|
||||
else:
|
||||
pivot.scale = Vector2(1.0, 1.0)
|
||||
pivot.rotation = 0.0
|
||||
|
||||
## Per-joint setter notify: updates the resolved TwoBoneIK mod's
|
||||
## flip_bend_direction and emits bend_flag_changed. No-op before _ready (the
|
||||
|
||||
Reference in New Issue
Block a user