Feat/14 movement overhaul #20

Merged
Dotts merged 86 commits from feat/14-movement-overhaul into main 2026-07-17 10:44:23 -07:00
5 changed files with 56 additions and 6 deletions
Showing only changes of commit 92713a681a - Show all commits
Binary file not shown.
Binary file not shown.
+20 -4
View File
@@ -68,10 +68,18 @@ func play_animation(name: String) -> void:
else: else:
print("SkinnedPlayerModel: animation '%s' not found" % name) print("SkinnedPlayerModel: animation '%s' not found" % name)
func update_state(state: String, speed: float, is_crouching: bool = false) -> void: func _process(delta: float) -> void:
if not animation_player: if not animation_player:
return return
# Poll the movement state machine for current state
var sm = get_parent().get_node_or_null("MovementStateMachine")
if not sm:
return
var state = sm.current_state
var speed = sm.movement_speed
match state: match state:
"ground", "idle": "ground", "idle":
if speed > 1.0: if speed > 1.0:
@@ -79,10 +87,18 @@ func update_state(state: String, speed: float, is_crouching: bool = false) -> vo
else: else:
play_animation("Idle") play_animation("Idle")
"air": "air":
play_animation("Idle") # TODO: add jump/fall anim play_animation("Idle")
"crouch": "crouch":
play_animation("Idle") # TODO: add crouch anim play_animation("Idle")
"slide": "slide":
play_animation("Run") # TODO: add slide anim play_animation("Run")
"wall_run":
play_animation("Run")
"wall_cling":
play_animation("Idle")
"grapple":
play_animation("Run")
"dash":
play_animation("Run")
_: _:
play_animation("Idle") play_animation("Idle")
+3 -2
View File
@@ -370,14 +370,15 @@ func _spawn_player(pid: int) -> CharacterBody3D:
player.set_script(mover_script) player.set_script(mover_script)
# Visual Model for Player # Visual Model for Player
# Player 1 gets the Miku skinned model, others get procedural humanoid
if pid == 1: if pid == 1:
# Miku: use the rigged GLB model with its own armature
var skinned = load("res://characters/skinned_player_model.gd").new() var skinned = load("res://characters/skinned_player_model.gd").new()
skinned.name = "SkinnedModel" skinned.name = "SkinnedModel"
skinned.model_path = "res://assets/characters/skins/miku_rigged_final.glb" skinned.model_path = "res://assets/characters/skins/miku_rigged_final.glb"
skinned.position = Vector3(0, -0.9, 0) skinned.position = Vector3.ZERO # Model origin = player origin
player.add_child(skinned) player.add_child(skinned)
else: else:
# Default: procedural humanoid
var humanoid = load("res://characters/humanoid_model.gd").new() var humanoid = load("res://characters/humanoid_model.gd").new()
humanoid.name = "HumanoidModel" humanoid.name = "HumanoidModel"
humanoid.color = Color(0.2, 0.4, 0.8) humanoid.color = Color(0.2, 0.4, 0.8)
+33
View File
@@ -0,0 +1,33 @@
@tool
extends EditorScript
func _run():
var source = "res://assets/characters/skins/miku_rigged_final.glb"
var dest = "res://assets/characters/skins/miku_rigged_imported.tscn"
print("Loading %s..." % source)
var glb = load(source)
if not glb:
print("ERROR: Failed to load GLB")
return
print("Instantiating...")
var scene = glb.instantiate()
if not scene:
print("ERROR: Failed to instantiate")
return
print("Scene: %s" % scene.name)
print("Children:")
for child in scene.get_children():
print(" %s (%s)" % [child.name, child.get_class()])
if child is Skeleton3D:
print(" Bones: %d" % child.get_bone_count())
if child is AnimationPlayer:
print(" Animations: %s" % child.get_animation_list())
# Save as scene
var packed = PackedScene.new()
packed.pack(scene)
ResourceSaver.save(packed, dest)
print("Saved to %s" % dest)