From 794aa73960c62dabaaf8d15fa74bfef646fd77b2 Mon Sep 17 00:00:00 2001 From: Sara Date: Thu, 6 Nov 2025 00:01:39 +0100 Subject: [PATCH] feat: integrated camera flash sound --- vr-project/vr_base.tscn | 60 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/vr-project/vr_base.tscn b/vr-project/vr_base.tscn index 990934f8..c4020dc2 100644 --- a/vr-project/vr_base.tscn +++ b/vr-project/vr_base.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=22 format=4 uid="uid://ctf3dsro4aqon"] +[gd_scene load_steps=28 format=4 uid="uid://ctf3dsro4aqon"] [ext_resource type="Texture2D" uid="uid://c0aarcidro2ml" path="res://Textures/HandLeftMat.png" id="1_pvnbl"] [ext_resource type="PackedScene" uid="uid://jl44wibohg6a" path="res://3D Models/Camera_asset.blend" id="2_pvnbl"] @@ -9,6 +9,7 @@ [ext_resource type="Texture2D" uid="uid://cvm0k5l7n5w7n" path="res://UI elements/Dele_Button.png" id="4_ho4oo"] [ext_resource type="Texture2D" uid="uid://dh1v02dybfrey" path="res://UI elements/Save Photo_Button.png" id="4_qs2no"] [ext_resource type="Texture2D" uid="uid://tuq77602j30a" path="res://UI elements/A_Button.png" id="5_71qfo"] +[ext_resource type="AudioStream" uid="uid://bof8u3k3pne1q" path="res://sounds/Detective SFX/photo taken2.ogg" id="6_hkenl"] [ext_resource type="Texture2D" uid="uid://brnep4ge1rh17" path="res://UI elements/B_Button.png" id="6_x2gwt"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nmntx"] @@ -98,6 +99,47 @@ _data = { &"RESET": SubResource("Animation_csfug") } +[sub_resource type="GDScript" id="GDScript_hkenl"] +script/source = "extends AudioStreamPlayer3D + +func _ready(): + $\"../MeshInstance3D\".visible = false + +func _on_clue_finder_found_marker_changed(has_marker: bool) -> void: + if has_marker: + play(0.0) + $\"../MeshInstance3D\".visible = true + get_tree().create_timer(0.2).timeout.connect($\"../MeshInstance3D\".set_visible.bind(false)) + get_tree().create_timer(0.3).timeout.connect($\"../MeshInstance3D\".set_visible.bind(true)) + get_tree().create_timer(0.35).timeout.connect($\"../MeshInstance3D\".set_visible.bind(false)) +" + +[sub_resource type="Gradient" id="Gradient_hkenl"] +offsets = PackedFloat32Array(0, 0.04085815, 0.37324345) +colors = PackedColorArray(1, 1, 1, 0, 1, 1, 1, 0.6745098, 1, 1, 1, 0) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_71yui"] +gradient = SubResource("Gradient_hkenl") +fill_from = Vector2(1, 0) +fill_to = Vector2(1, 1) + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_tuwdj"] +transparency = 4 +blend_mode = 1 +shading_mode = 0 +albedo_texture = SubResource("GradientTexture2D_71yui") +texture_repeat = false + +[sub_resource type="CylinderMesh" id="CylinderMesh_hkenl"] +material = SubResource("StandardMaterial3D_tuwdj") +top_radius = 0.0 +bottom_radius = 0.68 +height = 0.851 +radial_segments = 4 +rings = 1 +cap_top = false +cap_bottom = false + [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_w55c1"] resource_name = "Material.001" cull_mode = 2 @@ -360,6 +402,21 @@ material_override = ExtResource("3_btcmj") pixel_size = 0.0001 texture = ExtResource("3_iyk8l") +[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="RightController/ClueFinder/Camera_asset"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.04537191, 0.11853313, -0.033608295) +stream = ExtResource("6_hkenl") +script = SubResource("GDScript_hkenl") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="RightController/ClueFinder/Camera_asset"] +transform = Transform3D(-3.090862e-08, -1, -3.090862e-08, 0.70710677, -4.371139e-08, 0.70710677, -0.70710677, 0, 0.70710677, 0.36678803, 0.119230464, -0.04617412) +mesh = SubResource("CylinderMesh_hkenl") + +[node name="OmniLight3D" type="OmniLight3D" parent="RightController/ClueFinder/Camera_asset/MeshInstance3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.21691813, 3.7252903e-09, -7.450581e-09) +light_color = Color(0.59700024, 0.38, 1, 1) +light_energy = 2.876 +omni_range = 10.439486 + [node name="VR Hand Right Camera" type="Node3D" parent="RightController"] transform = Transform3D(0.85242325, 0.44246125, 0.2785726, -0.16515681, -0.27765465, 0.94637775, 0.4960825, -0.85272264, -0.16360374, 0.007563427, 0.00068473816, 0.0065676123) @@ -509,4 +566,5 @@ texture = ExtResource("4_ho4oo") transform = Transform3D(0.018740967, 3.4410212e-09, 5.763476e-10, -2.1877646e-09, 0.0034734658, 0.018416272, 2.2705073e-09, -0.018416267, 0.0034734665, -0.013277769, 0.011410562, -0.1448622) texture = ExtResource("5_71qfo") +[connection signal="found_marker_changed" from="RightController/ClueFinder" to="RightController/ClueFinder/Camera_asset/AudioStreamPlayer3D" method="_on_clue_finder_found_marker_changed"] [connection signal="found_marker_changed" from="RightController/ClueFinder" to="RightController/SendDeletePopup" method="_on_clue_finder_found_marker_changed"]