From 741c75c545cdcd7873dceeb93c93f82486e25cd1 Mon Sep 17 00:00:00 2001 From: Cory Petkovsek <632766+TokisanGames@users.noreply.github.com> Date: Wed, 17 Jul 2024 18:05:01 +0700 Subject: [PATCH] Update demo: fix caves, add tween camera --- project/demo/src/CaveEntrance.gd | 4 ++-- project/demo/src/Player.gd | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/project/demo/src/CaveEntrance.gd b/project/demo/src/CaveEntrance.gd index f49ab0cc..70e79485 100644 --- a/project/demo/src/CaveEntrance.gd +++ b/project/demo/src/CaveEntrance.gd @@ -8,7 +8,7 @@ func _ready() -> void: func _on_body_entered(body: Node3D) -> void: if body.name == "Player": - var env: WorldEnvironment = get_node_or_null("../../World/Environment") + var env: WorldEnvironment = get_node_or_null("../../Environment/WorldEnvironment") if env: var tween: Tween = get_tree().create_tween() tween.tween_property(env.environment, "ambient_light_energy", .1, .33) @@ -16,7 +16,7 @@ func _on_body_entered(body: Node3D) -> void: func _on_body_exited(body: Node3D) -> void: if body.name == "Player": - var env: WorldEnvironment = get_node_or_null("../../World/Environment") + var env: WorldEnvironment = get_node_or_null("../../Environment/WorldEnvironment") if env: var tween: Tween = get_tree().create_tween() tween.tween_property(env.environment, "ambient_light_energy", 1., .33) diff --git a/project/demo/src/Player.gd b/project/demo/src/Player.gd index 6b056dfa..e7f365a9 100644 --- a/project/demo/src/Player.gd +++ b/project/demo/src/Player.gd @@ -6,9 +6,12 @@ extends CharacterBody3D set(p_value): first_person = p_value if first_person: - $CameraManager/Arm.spring_length = 0.0 + var tween: Tween = create_tween() + tween.tween_property($CameraManager/Arm, "spring_length", 0.0, .33) + tween.tween_callback($Body.set_visible.bind(false)) else: - $CameraManager/Arm.spring_length = 6.0 + $Body.visible = true + create_tween().tween_property($CameraManager/Arm, "spring_length", 6.0, .33) @export var gravity_enabled: bool = true : set(p_value):