diff --git a/levels/mechanic_test/mechanic_test.gd b/levels/mechanic_test/mechanic_test.gd new file mode 100644 index 0000000..dcca6de --- /dev/null +++ b/levels/mechanic_test/mechanic_test.gd @@ -0,0 +1,27 @@ +extends Node3D +## Game mechanic testing level + +@onready var gunk_hall: GunkBody = %GunkHall + +@onready var bulkhead: Node3D = $Bulkhead +@onready var open_switch: Node3D = $Bulkhead/Podium/OpenSwitch +@onready var close_switch: Node3D = $Bulkhead/Podium2/CloseSwitch + +@onready var nodule_spawn_point: Marker3D = $NoduleSpawner/NoduleSpawnPoint + +static var nodule_scene: PackedScene = load("res://src/world/gunk_node/grunk_nodule.tscn") + + +func reset() -> void: + print("Resetting level!") + gunk_hall.mask_control.clear(Color.BLACK) + Callable(bulkhead, "close").call() + Callable(open_switch, "enable").call() + Callable(close_switch, "disable").call() + + +func spawn_nodule() -> void: + for c: Node in nodule_spawn_point.get_children(): + c.queue_free() + var instance := nodule_scene.instantiate() + nodule_spawn_point.add_child(instance) diff --git a/levels/mechanic_test/mechanic_test.gd.uid b/levels/mechanic_test/mechanic_test.gd.uid new file mode 100644 index 0000000..ee9b41c --- /dev/null +++ b/levels/mechanic_test/mechanic_test.gd.uid @@ -0,0 +1 @@ +uid://bvua1l2hb3an6 diff --git a/levels/mechanic_test/mechanic_test.tscn b/levels/mechanic_test/mechanic_test.tscn new file mode 100644 index 0000000..a08a65c --- /dev/null +++ b/levels/mechanic_test/mechanic_test.tscn @@ -0,0 +1,234 @@ +[gd_scene load_steps=28 format=4 uid="uid://b8rv6dg4tgaeb"] + +[ext_resource type="Script" uid="uid://bvua1l2hb3an6" path="res://levels/mechanic_test/mechanic_test.gd" id="1_bg05n"] +[ext_resource type="PackedScene" uid="uid://bwe2jdmvinhqd" path="res://src/player/player.tscn" id="1_goufh"] +[ext_resource type="PackedScene" uid="uid://b6eg8t04rkh0c" path="res://src/props/wall_switch/wall_switch.tscn" id="2_pka60"] +[ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="4_2uiim"] +[ext_resource type="Shader" uid="uid://ckxc0ngd37rtk" path="res://src/shaders/gunk.gdshader" id="5_0j1ke"] +[ext_resource type="Texture2D" uid="uid://8cm835h4gxwe" path="res://assets/debug_mask.png" id="5_x2vho"] +[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_x2vho"] +[ext_resource type="PackedScene" uid="uid://dvma1hufsl6mc" path="res://src/props/bulkhead/bulkhead.tscn" id="8_0j1ke"] + +[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_goufh"] + +[sub_resource type="Sky" id="Sky_pka60"] +sky_material = SubResource("ProceduralSkyMaterial_goufh") + +[sub_resource type="Environment" id="Environment_bg05n"] +background_mode = 2 +sky = SubResource("Sky_pka60") + +[sub_resource type="PlaneMesh" id="PlaneMesh_mn2wa"] +size = Vector2(50, 50) + +[sub_resource type="WorldBoundaryShape3D" id="WorldBoundaryShape3D_mn2wa"] + +[sub_resource type="BoxMesh" id="BoxMesh_goufh"] +size = Vector3(0.5, 2, 0.5) + +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_bg05n"] +data = PackedVector3Array(-0.25, 1, 0.25, 0.25, 1, 0.25, -0.25, -1, 0.25, 0.25, 1, 0.25, 0.25, -1, 0.25, -0.25, -1, 0.25, 0.25, 1, -0.25, -0.25, 1, -0.25, 0.25, -1, -0.25, -0.25, 1, -0.25, -0.25, -1, -0.25, 0.25, -1, -0.25, 0.25, 1, 0.25, 0.25, 1, -0.25, 0.25, -1, 0.25, 0.25, 1, -0.25, 0.25, -1, -0.25, 0.25, -1, 0.25, -0.25, 1, -0.25, -0.25, 1, 0.25, -0.25, -1, -0.25, -0.25, 1, 0.25, -0.25, -1, 0.25, -0.25, -1, -0.25, 0.25, 1, 0.25, -0.25, 1, 0.25, 0.25, 1, -0.25, -0.25, 1, 0.25, -0.25, 1, -0.25, 0.25, 1, -0.25, -0.25, -1, 0.25, 0.25, -1, 0.25, -0.25, -1, -0.25, 0.25, -1, 0.25, 0.25, -1, -0.25, -0.25, -1, -0.25) + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_rp2qp"] +load_path = "res://.godot/imported/debug_mask.png-fd2bc783338ed9439fe81a4eef9d86da.s3tc.ctex" + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_if0c2"] +width = 256 +height = 256 +depth = 32 +seamless = true +seamless_blend_skirt = 0.5 +noise = ExtResource("6_x2vho") + +[sub_resource type="NoiseTexture3D" id="NoiseTexture3D_2pd8h"] +width = 256 +height = 256 +depth = 32 +seamless = true +seamless_blend_skirt = 0.5 +noise = ExtResource("6_x2vho") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_iyuyb"] +resource_local_to_scene = true +render_priority = 0 +shader = ExtResource("5_0j1ke") +shader_parameter/color_1 = Color(0, 0.03, 0.1, 1) +shader_parameter/color_2 = Color(0, 0.1, 0.3, 1) +shader_parameter/emission_color = Color(0.25, 0.88, 1, 1) +shader_parameter/pixellation = 128.0 +shader_parameter/time_pixellation = 30.0 +shader_parameter/roughness = 0.15 +shader_parameter/specular_contribution = 0.8 +shader_parameter/emission_strength = 0.02 +shader_parameter/uv_scale = Vector2(4, 4) +shader_parameter/time_scale = 0.2 +shader_parameter/edge_bleed = 0.25 +shader_parameter/gunk_mask = SubResource("CompressedTexture2D_rp2qp") +shader_parameter/gunk_noise = SubResource("NoiseTexture3D_if0c2") +shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_2pd8h") +shader_parameter/jitter_magnitude = 0.0 +shader_parameter/jitter_time_scale = 0.1 +shader_parameter/vertex_inflation = 0.0 +shader_parameter/inflation_pixellation = 10.0 + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_2h3rs"] +load_path = "res://.godot/imported/hallway_2_C.png-368e035781dbfc292f80210e8377e1f9.ctex" + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_powch"] +load_path = "res://.godot/imported/hallway_2_M.png-f213557d859a0fe7aab8242b25a4a2c0.ctex" + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_sh2xs"] +load_path = "res://.godot/imported/hallway_2_N.png-6d22130ff0aeb6510ae322aebc31a58e.ctex" + +[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_tpfln"] +load_path = "res://.godot/imported/hallway_2_R.png-e22266e6db52a2c329569fdae3b64571.ctex" + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_2uiim"] +albedo_texture = SubResource("CompressedTexture2D_2h3rs") +metallic = 1.0 +metallic_texture = SubResource("CompressedTexture2D_powch") +roughness_texture = SubResource("CompressedTexture2D_tpfln") +normal_enabled = true +normal_texture = SubResource("CompressedTexture2D_sh2xs") +texture_filter = 4 + +[sub_resource type="ArrayMesh" id="ArrayMesh_0j1ke"] +_surfaces = [{ +"aabb": AABB(-1.5, 0, -6, 3, 3, 12), +"format": 34896613377, +"index_count": 24, +"index_data": PackedByteArray("AAABAAIAAgABAAMAAQAAAAQAAwAFAAIABAAAAAYABwAFAAMABAAGAAcABwAGAAUA"), +"name": "Cube", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 8, +"vertex_data": PackedByteArray("AAAAAAAAAAAAAAAA//8AAAAA//8AAAAAAAD/////AAD//wAA//8AAP////8AAAAA//8AAAAAAAD///////8AAA==") +}] +blend_shape_mode = 0 + +[sub_resource type="ArrayMesh" id="ArrayMesh_x2vho"] +_surfaces = [{ +"aabb": AABB(-1.5, 0, -6, 3, 3, 12), +"attribute_data": PackedByteArray("AAD/f////38AAP+/////v////z8AAP8///8AAAAAAAD///9/AAD/f////z8AAP8//////wAA//////+/AAD/vw=="), +"format": 34896613399, +"index_count": 24, +"index_data": PackedByteArray("AAABAAIAAgABAAMABAAFAAYABgAFAAcACAAJAAoACgAJAAsADAANAA4ADgANAA8A"), +"material": SubResource("StandardMaterial3D_2uiim"), +"name": "Cube", +"primitive": 3, +"uv_scale": Vector4(0, 0, 0, 0), +"vertex_count": 16, +"vertex_data": PackedByteArray("AAAAAAAA//8AAAAA/////wAA//8AAP//AAD//////////wAA////v///AAAAAP+//////////7//////AAD/vwAAAAD//1TVAAAAAAAAVNX//wAA//9U1f//AAAAAFTV////////VNX/////AABU1QAA/////1TVAAD//wAAVNX/v/9//7//f/+//3//v/9//3////9/////f////3///6qqqqqqqqqqqqqqqqqqqqqqKlTVqipU1aoqVNWqKlTV") +}] +blend_shape_mode = 0 +shadow_mesh = SubResource("ArrayMesh_0j1ke") + +[sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_qjnj2"] +data = PackedVector3Array(-1.5, 0, -6, -1.5, 0, 6, -1.5, 3, -6, -1.5, 3, -6, -1.5, 0, 6, -1.5, 3, 6, 1.5, 0, 6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, 6, 1.5, 0, -6, 1.5, 3, -6, -1.5, 0, 6, -1.5, 0, -6, 1.5, 0, 6, 1.5, 0, 6, -1.5, 0, -6, 1.5, 0, -6, 1.5, 3, 6, 1.5, 3, -6, -1.5, 3, 6, -1.5, 3, 6, 1.5, 3, -6, -1.5, 3, -6) + +[node name="MechanicTest" type="Node3D"] +script = ExtResource("1_bg05n") + +[node name="Player" parent="." instance=ExtResource("1_goufh")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."] +transform = Transform3D(0.866025, -0.156955, -0.474726, 0.5, 0.271854, 0.82225, 0, -0.949453, 0.31391, 0, 0, 0) + +[node name="WorldEnvironment" type="WorldEnvironment" parent="."] +environment = SubResource("Environment_bg05n") + +[node name="WorldFloor" type="StaticBody3D" parent="."] + +[node name="MeshInstance3D" type="MeshInstance3D" parent="WorldFloor"] +mesh = SubResource("PlaneMesh_mn2wa") +skeleton = NodePath("../..") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="WorldFloor"] +shape = SubResource("WorldBoundaryShape3D_mn2wa") + +[node name="ResetPodium" type="StaticBody3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -2) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="ResetPodium"] +mesh = SubResource("BoxMesh_goufh") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="ResetPodium"] +shape = SubResource("ConcavePolygonShape3D_bg05n") + +[node name="ResetSwitch" parent="ResetPodium" instance=ExtResource("2_pka60")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) +enabled = true + +[node name="Label3D" type="Label3D" parent="ResetPodium"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0.3) +text = "RESET" + +[node name="NoduleSpawner" type="StaticBody3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.5, 1, -6) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="NoduleSpawner"] +mesh = SubResource("BoxMesh_goufh") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="NoduleSpawner"] +shape = SubResource("ConcavePolygonShape3D_bg05n") + +[node name="SpawnSwitch" parent="NoduleSpawner" instance=ExtResource("2_pka60")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) +enabled = true + +[node name="Label3D" type="Label3D" parent="NoduleSpawner"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0.3) +text = "Spawn" + +[node name="NoduleSpawnPoint" type="Marker3D" parent="NoduleSpawner"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3) + +[node name="GunkHall" parent="." instance=ExtResource("4_2uiim")] +unique_name_in_owner = true +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.5, 0, -31) +initial_mask = ExtResource("5_x2vho") +source_gunk_material = SubResource("ShaderMaterial_iyuyb") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="GunkHall"] +mesh = SubResource("ArrayMesh_x2vho") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="GunkHall"] +shape = SubResource("ConcavePolygonShape3D_qjnj2") + +[node name="Bulkhead" parent="." instance=ExtResource("8_0j1ke")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.5, 0, -2) + +[node name="Podium" type="StaticBody3D" parent="Bulkhead"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2, 1, 0) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Bulkhead/Podium"] +mesh = SubResource("BoxMesh_goufh") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium"] +shape = SubResource("ConcavePolygonShape3D_bg05n") + +[node name="OpenSwitch" parent="Bulkhead/Podium" instance=ExtResource("2_pka60")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) +enabled = true + +[node name="Podium2" type="StaticBody3D" parent="Bulkhead"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 3, 1, 0) + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Bulkhead/Podium2"] +mesh = SubResource("BoxMesh_goufh") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Bulkhead/Podium2"] +shape = SubResource("ConcavePolygonShape3D_bg05n") + +[node name="CloseSwitch" parent="Bulkhead/Podium2" instance=ExtResource("2_pka60")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.4, 0.35) + +[connection signal="activated" from="ResetPodium/ResetSwitch" to="." method="reset"] +[connection signal="activated" from="NoduleSpawner/SpawnSwitch" to="." method="spawn_nodule"] +[connection signal="activated" from="Bulkhead/Podium/OpenSwitch" to="Bulkhead" method="open"] +[connection signal="activated" from="Bulkhead/Podium/OpenSwitch" to="Bulkhead/Podium/OpenSwitch" method="disable"] +[connection signal="activated" from="Bulkhead/Podium/OpenSwitch" to="Bulkhead/Podium2/CloseSwitch" method="enable"] +[connection signal="activated" from="Bulkhead/Podium2/CloseSwitch" to="Bulkhead" method="close"] +[connection signal="activated" from="Bulkhead/Podium2/CloseSwitch" to="Bulkhead/Podium/OpenSwitch" method="enable"] +[connection signal="activated" from="Bulkhead/Podium2/CloseSwitch" to="Bulkhead/Podium2/CloseSwitch" method="disable"] diff --git a/project.godot b/project.godot index e5c6e50..843d15c 100644 --- a/project.godot +++ b/project.godot @@ -11,6 +11,7 @@ config_version=5 [animation] warnings/check_invalid_track_paths=false +warnings/threads/thread_model=2 [application] diff --git a/src/equipment/toothbrush/toothbrush.tscn b/src/equipment/toothbrush/toothbrush.tscn index b02b207..3c0446e 100644 --- a/src/equipment/toothbrush/toothbrush.tscn +++ b/src/equipment/toothbrush/toothbrush.tscn @@ -5,6 +5,31 @@ [ext_resource type="Texture2D" uid="uid://6vc3ye0jnqy4" path="res://assets/ui/hud/tools/toothbrush_idle.png" id="3_sxute"] [ext_resource type="Texture2D" uid="uid://djisqgfxhsrs2" path="res://assets/ui/hud/tools/toothbrush_used.png" id="4_atd0h"] +[sub_resource type="Animation" id="Animation_8x7qe"] +length = 0.001 +tracks/0/type = "bezier" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:x") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0), +"times": PackedFloat32Array(0) +} +tracks/1/type = "bezier" +tracks/1/imported = false +tracks/1/enabled = true +tracks/1/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:y") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = { +"handle_modes": PackedInt32Array(0), +"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0), +"times": PackedFloat32Array(0) +} + [sub_resource type="Animation" id="Animation_atd0h"] resource_name = "brush" length = 0.6 @@ -32,31 +57,6 @@ tracks/1/keys = { "times": PackedFloat32Array(0, 0.6) } -[sub_resource type="Animation" id="Animation_8x7qe"] -length = 0.001 -tracks/0/type = "bezier" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:x") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0), -"times": PackedFloat32Array(0) -} -tracks/1/type = "bezier" -tracks/1/imported = false -tracks/1/enabled = true -tracks/1/path = NodePath("HUDTool/NozzleMarker/HUDElement/Pivot/TextureUsed:position:y") -tracks/1/interp = 1 -tracks/1/loop_wrap = true -tracks/1/keys = { -"handle_modes": PackedInt32Array(0), -"points": PackedFloat32Array(0, -0.2, 0, 0.2, 0), -"times": PackedFloat32Array(0) -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_8x7qe"] _data = { &"RESET": SubResource("Animation_8x7qe"), diff --git a/src/props/bulkhead/bulkhead.gd b/src/props/bulkhead/bulkhead.gd index c0d6f37..8150b72 100644 --- a/src/props/bulkhead/bulkhead.gd +++ b/src/props/bulkhead/bulkhead.gd @@ -7,3 +7,8 @@ extends Node3D func open() -> void: animation.play("open") dust_animation.play("spray") + + +func close() -> void: + # TODO bespoke close anim? + animation.play_backwards("open") diff --git a/src/props/wall_switch/wall_switch.gd b/src/props/wall_switch/wall_switch.gd index 8608d34..daee995 100644 --- a/src/props/wall_switch/wall_switch.gd +++ b/src/props/wall_switch/wall_switch.gd @@ -31,7 +31,7 @@ func enable() -> void: ## Called once the switch is no longer usable. Disables interaction & plays animations func disable() -> void: if enabled: - light_animation.queue("disable") + light_animation.play("disable") enabled = false interactive.enabled = false diff --git a/src/props/wall_switch/wall_switch.tscn b/src/props/wall_switch/wall_switch.tscn index b659f8c..8ecbaed 100644 --- a/src/props/wall_switch/wall_switch.tscn +++ b/src/props/wall_switch/wall_switch.tscn @@ -12,6 +12,7 @@ [ext_resource type="Script" uid="uid://deg5xd87cy8rg" path="res://src/props/interactive.gd" id="10_qw6jt"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jtkkw"] +resource_local_to_scene = true albedo_texture = ExtResource("2_vufqs") metallic = 1.0 metallic_texture = ExtResource("3_3fhmv") @@ -21,6 +22,7 @@ normal_texture = ExtResource("4_pg3hp") texture_filter = 2 [sub_resource type="ArrayMesh" id="ArrayMesh_6aabu"] +resource_local_to_scene = true resource_name = "wall_switch_Cube" _surfaces = [{ "aabb": AABB(-0.3, -0.4, -0.1, 0.6, 0.8, 0.2), @@ -75,27 +77,35 @@ shader_parameter/edge_bleed = 0.25 shader_parameter/gunk_mask = SubResource("CompressedTexture2D_ji5cn") shader_parameter/gunk_noise = SubResource("NoiseTexture3D_35kna") shader_parameter/gunk_normal_map = SubResource("NoiseTexture3D_4a0u4") +shader_parameter/jitter_magnitude = 0.0 +shader_parameter/jitter_time_scale = 0.1 +shader_parameter/vertex_inflation = 0.0 +shader_parameter/inflation_pixellation = 10.0 [sub_resource type="ConcavePolygonShape3D" id="ConcavePolygonShape3D_1xqlp"] data = PackedVector3Array(-0.24, -0.32, 0.1, -0.3, 0.4, -0.1, -0.24, 0.32, 0.1, -0.24, -0.32, 0.1, -0.3, -0.4, -0.1, -0.3, 0.4, -0.1, -0.3, -0.4, -0.1, 0.3, 0.4, -0.1, -0.3, 0.4, -0.1, -0.3, -0.4, -0.1, 0.3, -0.4, -0.1, 0.3, 0.4, -0.1, 0.3, -0.4, -0.1, 0.24, 0.32, 0.1, 0.3, 0.4, -0.1, 0.3, -0.4, -0.1, 0.24, -0.32, 0.1, 0.24, 0.32, 0.1, -0.24, -0.32, 0.1, 0.3, -0.4, -0.1, -0.3, -0.4, -0.1, 0.3, -0.4, -0.1, 0.1, -0.32, 0.1, 0.24, -0.32, 0.1, 0.3, -0.4, -0.1, -0.24, -0.32, 0.1, 0.1, -0.32, 0.1, 0.24, 0.32, 0.1, -0.3, 0.4, -0.1, 0.3, 0.4, -0.1, -0.3, 0.4, -0.1, 0.1, 0.32, 0.1, -0.24, 0.32, 0.1, -0.3, 0.4, -0.1, 0.24, 0.32, 0.1, 0.1, 0.32, 0.1, 0.24, -0.32, 0.1, 0.1, 0.32, 0.1, 0.24, 0.32, 0.1, 0.24, -0.32, 0.1, 0.1, -0.32, 0.1, 0.1, 0.32, 0.1, -0.19, 0.27, 0.1, -0.19, -0.27, 0.05, -0.19, -0.27, 0.1, -0.19, 0.27, 0.1, -0.19, 0.27, 0.05, -0.19, -0.27, 0.05, -0.19, 0.27, 0.1, 0.1, 0.32, 0.1, 0.05, 0.27, 0.1, -0.19, 0.27, 0.1, -0.24, 0.32, 0.1, 0.1, 0.32, 0.1, -0.19, -0.27, 0.1, -0.24, 0.32, 0.1, -0.19, 0.27, 0.1, -0.19, -0.27, 0.1, -0.24, -0.32, 0.1, -0.24, 0.32, 0.1, 0.05, -0.27, 0.1, -0.24, -0.32, 0.1, -0.19, -0.27, 0.1, 0.05, -0.27, 0.1, 0.1, -0.32, 0.1, -0.24, -0.32, 0.1, 0.05, 0.27, 0.1, 0.1, -0.32, 0.1, 0.05, -0.27, 0.1, 0.05, 0.27, 0.1, 0.1, 0.32, 0.1, 0.1, -0.32, 0.1, 0.05, -0.27, 0.05, -0.19, 0.27, 0.05, 0.05, 0.27, 0.05, 0.05, -0.27, 0.05, -0.19, -0.27, 0.05, -0.19, 0.27, 0.05, -0.19, -0.27, 0.1, 0.05, -0.27, 0.05, 0.05, -0.27, 0.1, -0.19, -0.27, 0.1, -0.19, -0.27, 0.05, 0.05, -0.27, 0.05, 0.05, 0.27, 0.1, -0.19, 0.27, 0.05, -0.19, 0.27, 0.1, 0.05, 0.27, 0.1, 0.05, 0.27, 0.05, -0.19, 0.27, 0.05, 0.05, -0.27, 0.1, 0.05, 0.27, 0.05, 0.05, 0.27, 0.1, 0.05, -0.27, 0.1, 0.05, -0.27, 0.05, 0.05, 0.27, 0.05, -0.175, 0.195, 0.075, -0.175, 0.245, 0.025, -0.175, 0.245, 0.075, -0.175, 0.195, 0.075, -0.175, 0.195, 0.025, -0.175, 0.245, 0.025, 0.0175, 0.195, 0.025, 0.035, 0.245, 0.025, 0.0175, 0.245, 0.025, 0.0175, 0.195, 0.025, 0.035, 0.195, 0.025, 0.035, 0.245, 0.025, 0.035, 0.195, 0.025, 0.035, 0.245, 0.075, 0.035, 0.245, 0.025, 0.035, 0.195, 0.025, 0.035, 0.195, 0.075, 0.035, 0.245, 0.075, -0.1575, 0.195, 0.075, -0.175, 0.245, 0.075, -0.1575, 0.245, 0.075, -0.1575, 0.195, 0.075, -0.175, 0.195, 0.075, -0.175, 0.245, 0.075, 0.0175, -0.225, 0.075, 0.0175, -0.25, 0.05, 0.0175, -0.225, 0.025, -0.1575, 0.245, 0.025, -0.175, 0.245, 0.075, -0.175, 0.245, 0.025, -0.1575, 0.245, 0.025, -0.1575, 0.245, 0.075, -0.175, 0.245, 0.075, 0.035, 0.245, 0.025, 0.0175, 0.245, 0.075, 0.0175, 0.245, 0.025, 0.035, 0.245, 0.025, 0.035, 0.245, 0.075, 0.0175, 0.245, 0.075, 0.0175, 0.245, 0.025, -0.1575, 0.245, 0.075, -0.1575, 0.245, 0.025, 0.0175, 0.245, 0.025, 0.0175, 0.245, 0.075, -0.1575, 0.245, 0.075, -0.175, 0.195, 0.075, -0.175, -0.225, 0.025, -0.175, 0.195, 0.025, -0.175, 0.195, 0.075, -0.175, -0.225, 0.075, -0.175, -0.225, 0.025, -0.1575, 0.195, 0.025, 0.0175, 0.195, 0.075, 0.0175, 0.195, 0.025, -0.1575, 0.195, 0.025, -0.1575, 0.195, 0.075, 0.0175, 0.195, 0.075, 0.035, 0.195, 0.075, 0.0175, 0.245, 0.075, 0.035, 0.245, 0.075, 0.035, 0.195, 0.075, 0.0175, 0.195, 0.075, 0.0175, 0.245, 0.075, 0.0175, 0.195, 0.075, -0.1575, 0.245, 0.075, 0.0175, 0.245, 0.075, 0.0175, 0.195, 0.075, -0.1575, 0.195, 0.075, -0.1575, 0.245, 0.075, -0.175, 0.195, 0.025, -0.1575, 0.245, 0.025, -0.175, 0.245, 0.025, -0.175, 0.195, 0.025, -0.1575, 0.195, 0.025, -0.1575, 0.245, 0.025, -0.1575, 0.195, 0.025, 0.0175, 0.245, 0.025, -0.1575, 0.245, 0.025, -0.1575, 0.195, 0.025, 0.0175, 0.195, 0.025, 0.0175, 0.245, 0.025, 0.035, 0.195, 0.075, 0.0175, -0.225, 0.075, 0.0175, 0.195, 0.075, 0.035, 0.195, 0.075, 0.035, -0.225, 0.075, 0.0175, -0.225, 0.075, -0.175, 0.195, 0.025, -0.1575, -0.225, 0.025, -0.1575, 0.195, 0.025, -0.175, 0.195, 0.025, -0.175, -0.225, 0.025, -0.1575, -0.225, 0.025, 0.0175, 0.195, 0.025, 0.035, -0.225, 0.025, 0.035, 0.195, 0.025, 0.0175, 0.195, 0.025, 0.0175, -0.225, 0.025, 0.035, -0.225, 0.025, -0.1575, 0.195, 0.075, -0.175, -0.225, 0.075, -0.175, 0.195, 0.075, -0.1575, 0.195, 0.075, -0.1575, -0.225, 0.075, -0.175, -0.225, 0.075, 0.035, -0.225, 0.025, 0.035, -0.25, 0.05, 0.035, -0.225, 0.075, -0.1575, -0.225, 0.025, -0.1575, -0.25, 0.05, -0.1575, -0.225, 0.075, -0.1575, -0.25, 0.05, -0.175, -0.225, 0.025, -0.175, -0.25, 0.05, -0.1575, -0.25, 0.05, -0.1575, -0.225, 0.025, -0.175, -0.225, 0.025, 0.0175, -0.25, 0.05, 0.035, -0.225, 0.075, 0.035, -0.25, 0.05, 0.0175, -0.25, 0.05, 0.0175, -0.225, 0.075, 0.035, -0.225, 0.075, 0.035, -0.25, 0.05, 0.0175, -0.225, 0.025, 0.0175, -0.25, 0.05, 0.035, -0.25, 0.05, 0.035, -0.225, 0.025, 0.0175, -0.225, 0.025, -0.175, -0.25, 0.05, -0.1575, -0.225, 0.075, -0.1575, -0.25, 0.05, -0.175, -0.25, 0.05, -0.175, -0.225, 0.075, -0.1575, -0.225, 0.075, -0.175, -0.225, 0.075, -0.175, -0.25, 0.05, -0.175, -0.225, 0.025, -0.1575, 0.195, 0.025, -0.1575, -0.225, 0.075, -0.1575, 0.195, 0.075, -0.1575, 0.195, 0.025, -0.1575, -0.225, 0.025, -0.1575, -0.225, 0.075, 0.0175, 0.195, 0.075, 0.0175, -0.225, 0.025, 0.0175, 0.195, 0.025, 0.0175, 0.195, 0.075, 0.0175, -0.225, 0.075, 0.0175, -0.225, 0.025, 0.035, 0.195, 0.025, 0.035, -0.225, 0.075, 0.035, 0.195, 0.075, 0.035, 0.195, 0.025, 0.035, -0.225, 0.025, 0.035, -0.225, 0.075) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_21svm"] +resource_local_to_scene = true albedo_color = Color(0, 0, 0, 1) emission_enabled = true emission = Color(0.866667, 0.109804, 0.101961, 1) emission_energy_multiplier = 0.0 [sub_resource type="BoxMesh" id="BoxMesh_g24yf"] +resource_local_to_scene = true material = SubResource("StandardMaterial3D_21svm") size = Vector3(0.08, 0.05, 0.025) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_0cc87"] +resource_local_to_scene = true albedo_color = Color(0, 0, 0, 1) emission_enabled = true emission = Color(0.137255, 0.984314, 0.34902, 1) emission_energy_multiplier = 0.0 [sub_resource type="BoxMesh" id="BoxMesh_a6hjm"] +resource_local_to_scene = true material = SubResource("StandardMaterial3D_0cc87") size = Vector3(0.08, 0.05, 0.025) @@ -126,6 +136,23 @@ tracks/1/keys = { "values": [0.0] } +[sub_resource type="Animation" id="Animation_6aabu"] +resource_name = "disable" +length = 2.0 +step = 0.05 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("Lights/SuccessLight:mesh:material:emission_energy_multiplier") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = { +"times": PackedFloat32Array(0, 2), +"transitions": PackedFloat32Array(0.618, 1), +"update": 0, +"values": [2.0, 0.0] +} + [sub_resource type="Animation" id="Animation_pea1n"] resource_name = "error_blink" length = 4.0 @@ -184,23 +211,6 @@ tracks/1/keys = { "values": [0.0] } -[sub_resource type="Animation" id="Animation_6aabu"] -resource_name = "disable" -length = 2.0 -step = 0.05 -tracks/0/type = "value" -tracks/0/imported = false -tracks/0/enabled = true -tracks/0/path = NodePath("Lights/SuccessLight:mesh:material:emission_energy_multiplier") -tracks/0/interp = 1 -tracks/0/loop_wrap = true -tracks/0/keys = { -"times": PackedFloat32Array(0, 2), -"transitions": PackedFloat32Array(0.618, 1), -"update": 0, -"values": [2.0, 0.0] -} - [sub_resource type="AnimationLibrary" id="AnimationLibrary_6ueib"] _data = { &"RESET": SubResource("Animation_ugm6b"), @@ -235,12 +245,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.17, 0.24, 0.1) [node name="DangerLight" type="MeshInstance3D" parent="Lights" index="0"] mesh = SubResource("BoxMesh_g24yf") -skeleton = NodePath("../..") [node name="SuccessLight" type="MeshInstance3D" parent="Lights" index="1"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.06, 0) mesh = SubResource("BoxMesh_a6hjm") -skeleton = NodePath("../..") [node name="LightAnimation" type="AnimationPlayer" parent="Lights" index="2"] unique_name_in_owner = true diff --git a/src/ui/canvas_projector.gd b/src/ui/canvas_projector.gd index d1df335..e4de431 100644 --- a/src/ui/canvas_projector.gd +++ b/src/ui/canvas_projector.gd @@ -9,6 +9,8 @@ func _ready() -> void: func _process(_delta: float) -> void: var camera := get_viewport().get_camera_3d() + if not camera: + return var px_coord := camera.unproject_position(global_position) for c: Node in get_children(): if c is Control: