人物控制器1

This commit is contained in:
2026-10-09 15:51:24 +08:00
parent d20d45fffc
commit 96e21757c3
6 changed files with 140 additions and 25 deletions
+4 -1
View File
@@ -79,10 +79,13 @@ func _on_pickup_interact_state_changed(hovering: bool, holding: bool) -> void:
func _physics_process(delta: float) -> void:
# 顺序固定:算速度 → 推进 → 播动画 → 搬物体。
# 顺序固定:算速度 → 同步蹲伏高度 → 推进 → 播动画 → 搬物体。
# 由根节点统一编排,各组件自己不许写 _physics_process ——
# 否则顺序取决于节点树顺序,改个节点位置就会出现「先滑再算速度」这类隐形 bug。
motor.step(delta)
# 蹲伏状态由 Motor 单点判定,再转交给 Look 去升降摄像机 ——
# 不让 Look 自己去读蹲键,免得两个组件各判一次、将来不同步。
look.set_crouching(motor.crouching)
move_and_slide()
animation_player.set_motion(velocity, is_on_floor(), motor.sprinting, motor.crouching)
pickup.physics_step()