diff --git a/scenes/prologue/act1_room.tscn b/scenes/prologue/act1_room.tscn index 0873cb2..57d7a21 100644 --- a/scenes/prologue/act1_room.tscn +++ b/scenes/prologue/act1_room.tscn @@ -650,7 +650,7 @@ material_override = SubResource("mat_note") shape = SubResource("shape_note") [node name="FatherNPC" parent="." instance=ExtResource("100_father")] -transform = Transform3D(0, 0, -2.35, 0, 2.35, 0, 2.35, 0, 0, 1.6, 0, 0) +transform = Transform3D(0, 0, -1.7, 0, 1.7, 0, 1.7, 0, 0, 1.7, 0, 0) [node name="PlayerFPV" parent="." instance=ExtResource("3_player")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.5) diff --git a/scripts/prologue/act1.gd b/scripts/prologue/act1.gd index e3f4f73..8142de8 100644 --- a/scripts/prologue/act1.gd +++ b/scripts/prologue/act1.gd @@ -15,8 +15,7 @@ var state: State = State.INTRO func _ready() -> void: _hide_noise_items() _apply_textures() - # Deferred — glb children могут быть не готовы в _ready parent сцены - call_deferred("_start_father_idle") + _start_father_idle() # внутри ждёт 2 frame чтоб glb инициализировался player.interactable_focused.connect(_on_player_focused) player.interactable_unfocused.connect(_on_player_unfocused) @@ -28,22 +27,28 @@ func _ready() -> void: func _start_father_idle() -> void: # Kenney glb имеют 32 анимации, но не играют ничего по умолчанию → - # модель в T-pose (руки в стороны). Запускаем idle если есть. + # T-pose. Запускаем idle. + # Ждём 2 кадра — glb subscene полностью инстанцируется через + # несколько кадров после _ready родителя. + await get_tree().process_frame + await get_tree().process_frame + var anim_player: AnimationPlayer = father.find_child("AnimationPlayer", true, false) as AnimationPlayer if anim_player == null: + print("[father] AnimationPlayer NOT FOUND. Дети father:") + for c in father.get_children(): + print(" - ", c.name, " (", c.get_class(), ")") + for gc in c.get_children(): + print(" - ", gc.name, " (", gc.get_class(), ")") return - var anims: PackedStringArray = anim_player.get_animation_list() - if anims.size() == 0: - return - var idle_name: String = "" - for name in anims: - if "idle" in name.to_lower(): - idle_name = name - break - if idle_name == "": - idle_name = anims[0] - anim_player.play(idle_name) - print("[father] playing animation: ", idle_name, " (всего: ", anims.size(), ")") + print("[father] AnimationPlayer FOUND, %d анимаций" % anim_player.get_animation_list().size()) + anim_player.autoplay = "idle" + anim_player.play("idle") + if anim_player.is_playing(): + print("[father] idle ИГРАЕТСЯ") + else: + print("[father] idle НЕ ИГРАЕТСЯ — пробую static") + anim_player.play("static") func _hide_noise_items() -> void: diff --git a/scripts/util/inspect_models.gd.uid b/scripts/util/inspect_models.gd.uid new file mode 100644 index 0000000..a4d304b --- /dev/null +++ b/scripts/util/inspect_models.gd.uid @@ -0,0 +1 @@ +uid://c4n88apy5o1he