Avatar: fix inside-out black shell + add a procedural walk cycle
checkpoint / checkpoint (push) Successful in 1m52s
checkpoint / checkpoint (push) Successful in 1m52s
The blocky body rendered fully black from every angle: _append_box wound its faces clockwise-from-outside, so every computed normal pointed inward -- an inside-out shell, lit from behind on all sides, and the level had ambient light disabled so nothing lifted it. Fixed the winding (normals now verify outward 234:36) and switched test_level's environment to a soft colour ambient so shaded sides read grey, not pure black. Limbs were static because the rig had no animation at all. Added scripts/avatar/limb_animator.gd: a clip-free walk cycle that swings the upper arm/leg bones with ground speed, folds the knees on the rear stride, and eases back to rest when idle. Wired into the local player (speed from velocity) and remote players in game.gd (speed from the per-snapshot authoritative position delta). Verified: avatar smoke 14/14 from source and exported pack; fresh-clone boot PASS; game + menu boot headless clean. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015jtxAiu5dAW4WxCNdGkrkJ
This commit is contained in:
@@ -42,6 +42,7 @@ const PITCH_MAX: float = 0.45
|
||||
@onready var _capsule_mesh: MeshInstance3D = $CapsuleMesh
|
||||
|
||||
var _avatar_view: Node3D = null
|
||||
var _limb_anim: Node = null
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
@@ -107,6 +108,14 @@ func _apply_avatar() -> void:
|
||||
if _capsule_mesh:
|
||||
_capsule_mesh.visible = false
|
||||
|
||||
# Procedural walk cycle -- no clips yet, just swing the limb bones with
|
||||
# ground speed.
|
||||
var skel := avatar.find_child("Skeleton3D", true, false)
|
||||
if skel is Skeleton3D:
|
||||
_limb_anim = preload("res://scripts/avatar/limb_animator.gd").new()
|
||||
add_child(_limb_anim)
|
||||
_limb_anim.call("setup", skel)
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# _unhandled_input — capture keyboard / mouse for movement
|
||||
@@ -194,6 +203,9 @@ func _physics_process(delta: float) -> void:
|
||||
|
||||
move_and_slide()
|
||||
|
||||
if _limb_anim != null:
|
||||
_limb_anim.set("speed", Vector2(velocity.x, velocity.z).length())
|
||||
|
||||
# Safety net -- never fall forever if something goes wrong.
|
||||
if global_position.y < -10.0:
|
||||
global_position = _spawn_position
|
||||
|
||||
Reference in New Issue
Block a user