fix(vagrant): hip-anchors body-relative; leg-orientation procedural
User feedback: 'anchorpoints sind hüftgelenke und können sich nicht frei drehen. hüfte bleibt zum körper statisch'. Architecture: - legs.parent = body (was lower_control). Hip position cascades from body.world.rot, so hips stay at body-frame left/right regardless of body rotation. lower_control virtual bone removed (no longer needed). - Procedural 'leg_orientation' sets leg.local.rot = walk_dir - body.rot each frame, so leg.world.rot = walk_dir (independent of body cascade). Requires puppet v0.4.2 per-channel write_bone (walk_anim writes leg.scl while procedural writes leg.rot — disjoint channels). Result: legs visually attach at body's anatomical left/right hips no matter where body faces; stride oscillation aligns with WASD walk direction. Hip position no longer drifts with walk direction.
This commit is contained in:
14
init.lua
14
init.lua
@@ -154,9 +154,17 @@ function M.init(ctx)
|
||||
puppet.play(state.player, "idle", { loop = true })
|
||||
puppet.play(state.player, "idle_lower", { loop = true })
|
||||
|
||||
-- Procedural lower_control: applies the per-frame wedge rotation (set by update_lower_anim).
|
||||
puppet.set_procedural(state.player, "lower_control", function(handle, dt)
|
||||
puppet.write_bone(handle, "lower_control", { rot = state.lower_control_rot_deg })
|
||||
-- Procedural leg-orientation: hips are body-relative (legs.parent=body, so
|
||||
-- cascade-position follows body); the leg ROTATION is overridden each
|
||||
-- frame to align with walk-direction (independent of body rotation).
|
||||
-- leg.local.rot = walk_dir_world - body.world.rot → leg.world.rot = walk_dir.
|
||||
-- write_bone allowed on leg.rot because walk_fwd_lower only writes leg.scl
|
||||
-- (per-channel guard v0.4.2).
|
||||
puppet.set_procedural(state.player, "leg_orientation", function(handle, dt)
|
||||
local _, _, body_rot = puppet.bone_world_transform(handle, "body")
|
||||
local leg_local_deg = state.lower_control_rot_deg - math.deg(body_rot)
|
||||
puppet.write_bone(handle, "leg_l", { rot = leg_local_deg })
|
||||
puppet.write_bone(handle, "leg_r", { rot = leg_local_deg })
|
||||
end)
|
||||
|
||||
-- Furniture textures.
|
||||
|
||||
Reference in New Issue
Block a user