fix: Articulate pants with leg bones and fix walking animation clipping
checkpoint / checkpoint (push) Successful in 6m11s

This commit is contained in:
2026-09-20 21:05:55 +00:00
parent a7de464e1f
commit ddcc0866b8
4 changed files with 73 additions and 25 deletions
+21 -10
View File
@@ -458,27 +458,38 @@ func _gen_pants_cargo() -> void:
pocket_mat.albedo_color = Color(0.20, 0.24, 0.32) # Dark pocket trim
pocket_mat.roughness = 0.9
# 1. Waist section (covering hips across both legs)
# 1. Waist mounted to Hips bone (Y=0.76)
var attach_hips := Node3D.new()
attach_hips.name = "Attach_Hips"
root.add_child(attach_hips)
var waist := MeshInstance3D.new()
waist.name = "Waist"
var waist_mesh := BoxMesh.new()
waist_mesh.size = Vector3(0.86, 0.20, 0.50)
waist_mesh.size = Vector3(0.88, 0.22, 0.52)
waist.mesh = waist_mesh
waist.position = Vector3(0.0, -0.06, 0.0) # Relative to Hips bone (Y=0.76)
waist.position = Vector3(0.0, -0.05, 0.0) # Relative to Hips (Y=0.76), covers world Y 0.60 to 0.82
waist.material_override = pants_mat
root.add_child(waist)
attach_hips.add_child(waist)
# 2. Left and Right Pant Legs (legs are 0.40 wide, 0.78 tall, 0.46 deep, centers X = +-0.21)
# 2. Left and Right Pant Legs mounted to LeftUpperLeg and RightUpperLeg
for side in [-1.0, 1.0]:
var sname := "Right" if side < 0.0 else "Left"
var attach_leg := Node3D.new()
attach_leg.name = "Attach_%sUpperLeg" % sname
root.add_child(attach_leg)
var leg := MeshInstance3D.new()
leg.name = "PantLeg_%s" % sname
var leg_mesh := BoxMesh.new()
leg_mesh.size = Vector3(0.44, 0.64, 0.50) # Covers down to ankle
# Encases leg from hip joint down to ankle/sole.
# Relative to UpperLeg bone (Y=0.74), center Y=-0.37, height 0.76 covers Y=-0.75 to +0.01 (world Y=-0.01 to 0.75).
# Width 0.44 encloses 0.40 leg, Depth 0.50 encloses 0.46 leg.
leg_mesh.size = Vector3(0.44, 0.76, 0.50)
leg.mesh = leg_mesh
leg.position = Vector3(side * 0.21, -0.34, 0.0)
leg.position = Vector3(0.0, -0.37, 0.0)
leg.material_override = pants_mat
root.add_child(leg)
attach_leg.add_child(leg)
# Cargo pocket on outer side
var pocket := MeshInstance3D.new()
@@ -486,9 +497,9 @@ func _gen_pants_cargo() -> void:
var pocket_mesh := BoxMesh.new()
pocket_mesh.size = Vector3(0.08, 0.20, 0.24)
pocket.mesh = pocket_mesh
pocket.position = Vector3(side * 0.44, -0.32, 0.0)
pocket.position = Vector3(side * 0.23, -0.32, 0.0)
pocket.material_override = pocket_mat
root.add_child(pocket)
attach_leg.add_child(pocket)
_write_glb(root, "pants_cargo_01")
root.free()