diff --git a/assets/02 midpiano.ogg b/assets/02 midpiano.ogg new file mode 100644 index 0000000..404e516 Binary files /dev/null and b/assets/02 midpiano.ogg differ diff --git a/assets/02 midpiano.ogg.import b/assets/02 midpiano.ogg.import new file mode 100644 index 0000000..4784f54 --- /dev/null +++ b/assets/02 midpiano.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://cv0f1tu5pac60" +path="res://.godot/imported/02 midpiano.ogg-f0bff299af52583bc6ba27e91b4b8750.oggvorbisstr" + +[deps] + +source_file="res://assets/02 midpiano.ogg" +dest_files=["res://.godot/imported/02 midpiano.ogg-f0bff299af52583bc6ba27e91b4b8750.oggvorbisstr"] + +[params] + +loop=true +loop_offset=0.0 +bpm=140.0 +beat_count=0 +bar_beats=4 diff --git a/assets/03 highpiano.ogg b/assets/03 highpiano.ogg new file mode 100644 index 0000000..a60b981 Binary files /dev/null and b/assets/03 highpiano.ogg differ diff --git a/assets/03 highpiano.ogg.import b/assets/03 highpiano.ogg.import new file mode 100644 index 0000000..cb77cfc --- /dev/null +++ b/assets/03 highpiano.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://cqb1bo72232vs" +path="res://.godot/imported/03 highpiano.ogg-206dd132bbe2dcd683287c1b7048c90c.oggvorbisstr" + +[deps] + +source_file="res://assets/03 highpiano.ogg" +dest_files=["res://.godot/imported/03 highpiano.ogg-206dd132bbe2dcd683287c1b7048c90c.oggvorbisstr"] + +[params] + +loop=true +loop_offset=0.0 +bpm=140.0 +beat_count=0 +bar_beats=4 diff --git a/assets/04 bass.ogg b/assets/04 bass.ogg new file mode 100644 index 0000000..512bec0 Binary files /dev/null and b/assets/04 bass.ogg differ diff --git a/assets/04 bass.ogg.import b/assets/04 bass.ogg.import new file mode 100644 index 0000000..992e2ee --- /dev/null +++ b/assets/04 bass.ogg.import @@ -0,0 +1,19 @@ +[remap] + +importer="oggvorbisstr" +type="AudioStreamOggVorbis" +uid="uid://dnwh2iqwi86ku" +path="res://.godot/imported/04 bass.ogg-a522f0b84ade86fc91d4d06447ccaf6c.oggvorbisstr" + +[deps] + +source_file="res://assets/04 bass.ogg" +dest_files=["res://.godot/imported/04 bass.ogg-a522f0b84ade86fc91d4d06447ccaf6c.oggvorbisstr"] + +[params] + +loop=true +loop_offset=0.0 +bpm=140.0 +beat_count=0 +bar_beats=4 diff --git a/default_bus_layout.tres b/default_bus_layout.tres new file mode 100644 index 0000000..1d27188 --- /dev/null +++ b/default_bus_layout.tres @@ -0,0 +1,17 @@ +[gd_resource type="AudioBusLayout" load_steps=2 format=3 uid="uid://nogxca8rciib"] + +[sub_resource type="AudioEffectReverb" id="AudioEffectReverb_ueffj"] +resource_name = "Reverb" +predelay_msec = 30.0 +room_size = 0.43 +wet = 0.2 + +[resource] +bus/1/name = &"Reverb" +bus/1/solo = false +bus/1/mute = false +bus/1/bypass_fx = false +bus/1/volume_db = 0.0 +bus/1/send = &"Master" +bus/1/effect/0/effect = SubResource("AudioEffectReverb_ueffj") +bus/1/effect/0/enabled = true diff --git a/scenes/proxy_collision_detector.gd b/scenes/proxy_collision_detector.gd index ddf1155..ca132f5 100644 --- a/scenes/proxy_collision_detector.gd +++ b/scenes/proxy_collision_detector.gd @@ -83,6 +83,10 @@ func _ready(): if i < target_collision_shapes.size() and target_collision_shapes[i] and (target_collision_shapes[i].shape is BoxShape3D): var box: BoxShape3D = target_collision_shapes[i].shape as BoxShape3D var gxf: Transform3D = target_collision_shapes[i].global_transform + print("Target %d:" % i) + print(" Box extents: ", box.extents) + print(" Global transform origin: ", gxf.origin) + print(" Global transform basis: ", gxf.basis) centers.append(gxf.origin) extents.append(box.extents) inv_bases.append(gxf.basis.inverse()) # Precompute the inverse once. diff --git a/scenes/proxy_collision_detector.tscn b/scenes/proxy_collision_detector.tscn index 1959b09..ba6ad3a 100644 --- a/scenes/proxy_collision_detector.tscn +++ b/scenes/proxy_collision_detector.tscn @@ -9,7 +9,7 @@ background_mode = 1 script = ExtResource("1_ijo8k") [node name="SubViewport" type="SubViewport" parent="."] -size = Vector2i(8, 8) +size = Vector2i(8, 2) render_target_update_mode = 4 [node name="Camera3D" type="Camera3D" parent="SubViewport"] diff --git a/scenes/target_highlight_test.gd b/scenes/target_highlight_test.gd index d9f84ff..a5151a7 100644 --- a/scenes/target_highlight_test.gd +++ b/scenes/target_highlight_test.gd @@ -2,19 +2,28 @@ extends StaticBody3D @export var index: int = 0 +@export var lerp_speed: float = 5.0 @onready var mesh: MeshInstance3D = $MeshInstance3D +@onready var audio: AudioStreamPlayer3D = $AudioStreamPlayer3D + +var _target_occupancy: float = 0.0 +var _current_occupancy: float = 0.0 func _ready() -> void: pass # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(_delta: float) -> void: - pass +func _process(delta: float) -> void: + _current_occupancy = lerp(_current_occupancy, _target_occupancy, lerp_speed * delta) + + var material = mesh.get_surface_override_material(0) + if material: + material.emission_energy_multiplier = _current_occupancy * 10 + if audio: + audio.volume_db = linear_to_db(_current_occupancy) func _on_proxy_collision_detector_target_occupancy_changed(target_index: int, occupancy: float) -> void: if target_index == index: - var material = mesh.get_surface_override_material(0) - if material: - material.emission_energy_multiplier = occupancy * 10 + _target_occupancy = occupancy diff --git a/scenes/title_scene.tscn b/scenes/title_scene.tscn index d7cd3e2..44c019f 100644 --- a/scenes/title_scene.tscn +++ b/scenes/title_scene.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=35 format=3 uid="uid://bd86thqpujh3p"] +[gd_scene load_steps=41 format=3 uid="uid://bd86thqpujh3p"] [ext_resource type="Script" path="res://addons/godot-xr-tools/staging/scene_base.gd" id="1_t86sx"] [ext_resource type="PackedScene" uid="uid://7uc6tf2tvn1k" path="res://scenes/xr_origin_3d.tscn" id="2_xk21l"] @@ -12,7 +12,10 @@ [ext_resource type="PackedScene" uid="uid://c20kawop2lrv" path="res://assets/Arcane Source 2.glb" id="8_h17hj"] [ext_resource type="Script" path="res://scenes/target_highlight_test.gd" id="9_jig6v"] [ext_resource type="PackedScene" uid="uid://bixan352mi1j6" path="res://scenes/manipulator.tscn" id="10_dms3y"] +[ext_resource type="AudioStream" uid="uid://dnwh2iqwi86ku" path="res://assets/04 bass.ogg" id="12_8dki8"] +[ext_resource type="AudioStream" uid="uid://cv0f1tu5pac60" path="res://assets/02 midpiano.ogg" id="13_6bsa0"] [ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="13_ab6mb"] +[ext_resource type="AudioStream" uid="uid://cqb1bo72232vs" path="res://assets/03 highpiano.ogg" id="14_8b4v6"] [ext_resource type="PackedScene" uid="uid://cyd8poa47ir2i" path="res://scenes/performance_settings_menu.tscn" id="14_s5dwy"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lvd12"] @@ -98,7 +101,7 @@ curve = SubResource("Curve_y0yng") [sub_resource type="BoxMesh" id="BoxMesh_0cc1r"] -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fof64"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_m6mak"] transparency = 1 albedo_color = Color(1, 1, 1, 0.3) emission_enabled = true @@ -107,7 +110,18 @@ emission_energy_multiplier = 0.61 rim = 0.38 refraction_scale = 0.88 -[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_n0pd7"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_sffkp"] +transparency = 1 +albedo_color = Color(1, 1, 1, 0.3) +emission_enabled = true +emission = Color(1, 1, 1, 1) +emission_energy_multiplier = 0.61 +rim = 0.38 +refraction_scale = 0.88 + +[sub_resource type="BoxMesh" id="BoxMesh_ootr5"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_o8q0i"] transparency = 1 albedo_color = Color(1, 1, 1, 0.3) emission_enabled = true @@ -126,6 +140,9 @@ emission = Color(0.208505, 0.70691, 0.626474, 1) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_a5rjy"] shading_mode = 0 +[sub_resource type="BoxShape3D" id="BoxShape3D_jwkgy"] +size = Vector3(40, 40, 40) + [node name="TitleScene" type="Node3D"] script = ExtResource("1_t86sx") @@ -187,37 +204,66 @@ texture = ExtResource("6_l378m") [node name="ProxyCollisionDetector" parent="." instance=ExtResource("7_1kkxh")] source_particles_path = NodePath("../GPUParticles3D") -target_collision_shapes_paths = Array[NodePath]([NodePath("../Target/CollisionShape3D"), NodePath("../Target2/CollisionShape3D")]) +target_collision_shapes_paths = Array[NodePath]([NodePath("../Target1/CollisionShape3D1"), NodePath("../Target2/CollisionShape3D2"), NodePath("../Target3/CollisionShape3D3")]) [node name="Arcane Source 2" parent="." instance=ExtResource("8_h17hj")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.186696, -0.0137267, -6.72164) +transform = Transform3D(0.837576, 0, 0.546321, 0, 1, 0, -0.546321, 0, 0.837576, -3.43117, -0.0137267, -5.21196) -[node name="Target" type="StaticBody3D" parent="."] +[node name="Target1" type="StaticBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.31548, 4.27292, -10.1667) script = ExtResource("9_jig6v") -[node name="CollisionShape3D" type="CollisionShape3D" parent="Target"] +[node name="CollisionShape3D1" type="CollisionShape3D" parent="Target1"] shape = SubResource("BoxShape3D_gofwq") -[node name="MeshInstance3D" type="MeshInstance3D" parent="Target"] +[node name="MeshInstance3D" type="MeshInstance3D" parent="Target1"] layers = 4 mesh = SubResource("BoxMesh_0cc1r") skeleton = NodePath("../..") -surface_material_override/0 = SubResource("StandardMaterial3D_fof64") +surface_material_override/0 = SubResource("StandardMaterial3D_m6mak") + +[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="Target1"] +stream = ExtResource("14_8b4v6") +volume_db = -80.0 +autoplay = true [node name="Target2" type="StaticBody3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.21807, 4.27292, -10.0553) script = ExtResource("9_jig6v") index = 1 -[node name="CollisionShape3D" type="CollisionShape3D" parent="Target2"] +[node name="CollisionShape3D2" type="CollisionShape3D" parent="Target2"] shape = SubResource("BoxShape3D_gofwq") [node name="MeshInstance3D" type="MeshInstance3D" parent="Target2"] layers = 4 mesh = SubResource("BoxMesh_0cc1r") skeleton = NodePath("../..") -surface_material_override/0 = SubResource("StandardMaterial3D_n0pd7") +surface_material_override/0 = SubResource("StandardMaterial3D_sffkp") + +[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="Target2"] +stream = ExtResource("13_6bsa0") +volume_db = -80.0 +autoplay = true + +[node name="Target3" type="StaticBody3D" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.005826, 1.90465, -9.1875) +script = ExtResource("9_jig6v") +index = 2 + +[node name="CollisionShape3D3" type="CollisionShape3D" parent="Target3"] +shape = SubResource("BoxShape3D_gofwq") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Target3"] +layers = 4 +mesh = SubResource("BoxMesh_ootr5") +skeleton = NodePath("../..") +surface_material_override/0 = SubResource("StandardMaterial3D_o8q0i") + +[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="Target3"] +stream = ExtResource("12_8dki8") +volume_db = -80.0 +autoplay = true [node name="Manipulator0" parent="." instance=ExtResource("10_dms3y")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 3.63926, -9.75923) @@ -253,8 +299,17 @@ update_mode = 2 material = SubResource("StandardMaterial3D_a5rjy") scene_properties_keys = PackedStringArray("performance_settings_menu.gd") -[connection signal="target_occupancy_changed" from="ProxyCollisionDetector" to="Target" method="_on_proxy_collision_detector_target_occupancy_changed"] +[node name="ReverbArea" type="Area3D" parent="."] +reverb_bus_enabled = true +reverb_bus_name = &"Reverb" +reverb_bus_amount = 1.0 + +[node name="CollisionShape3D" type="CollisionShape3D" parent="ReverbArea"] +shape = SubResource("BoxShape3D_jwkgy") + +[connection signal="target_occupancy_changed" from="ProxyCollisionDetector" to="Target1" method="_on_proxy_collision_detector_target_occupancy_changed"] [connection signal="target_occupancy_changed" from="ProxyCollisionDetector" to="Target2" method="_on_proxy_collision_detector_target_occupancy_changed"] +[connection signal="target_occupancy_changed" from="ProxyCollisionDetector" to="Target3" method="_on_proxy_collision_detector_target_occupancy_changed"] [editable path="Manipulator0"] [editable path="Manipulator1"] diff --git a/scenes/xr_origin_3d.tscn b/scenes/xr_origin_3d.tscn index a2e07bb..8c63ed3 100644 --- a/scenes/xr_origin_3d.tscn +++ b/scenes/xr_origin_3d.tscn @@ -27,6 +27,9 @@ bounce_threshold = 1.0 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.72, 0) cull_mask = 524287 +[node name="AudioListener3D" type="AudioListener3D" parent="XRCamera3D"] +current = true + [node name="LeftHand" type="XRController3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.25, 1, 0) tracker = &"left_hand" @@ -61,6 +64,7 @@ world_scale_min = 0.01 world_scale_max = 10.0 [node name="PlayerBody" parent="." instance=ExtResource("5_ug2p8")] +collision_mask = 0 motion_mode = 1 push_rigid_bodies = false physics = SubResource("Resource_117uy")