diff --git a/addons/godot-xr-tools/user_settings/user_settings.gd b/addons/godot-xr-tools/user_settings/user_settings.gd index c6f513f..9eada34 100644 --- a/addons/godot-xr-tools/user_settings/user_settings.gd +++ b/addons/godot-xr-tools/user_settings/user_settings.gd @@ -220,4 +220,3 @@ func get_adjusted_vector2(p_controller, p_input_action): vector.x *= -1 return vector - diff --git a/override.cfg b/override.cfg index 0d1998e..4cd32b3 100644 --- a/override.cfg +++ b/override.cfg @@ -1,3 +1,3 @@ [xr] -openxr/enabled=false +openxr/enabled=true diff --git a/scenes/base_game_scene.gd b/scenes/base_game_scene.gd index 3289afc..32cce39 100644 --- a/scenes/base_game_scene.gd +++ b/scenes/base_game_scene.gd @@ -15,6 +15,9 @@ func _ready(): if Engine.is_editor_hint(): return + # reset the world scale to 1.0 + XRServer.world_scale = 1.0 + # for editor testing when scene is directly loaded _reset_manipulators() @@ -80,4 +83,4 @@ func check_puzzle_completion(delta: float) -> void: puzzle_completed.emit() else: _completion_timer = 0.0 - \ No newline at end of file + diff --git a/scenes/level_select.tscn b/scenes/level_select.tscn new file mode 100644 index 0000000..f246ad7 --- /dev/null +++ b/scenes/level_select.tscn @@ -0,0 +1,47 @@ +[gd_scene load_steps=3 format=3 uid="uid://m1twp7r5vtv0"] + +[ext_resource type="Theme" uid="uid://bfjhdxefw3nxu" path="res://scenes/new_theme.tres" id="1_0shvn"] +[ext_resource type="Script" path="res://scenes/scene_select_button.gd" id="2_4d80g"] + +[node name="LevelSelect" type="Node2D"] + +[node name="MarginContainer" type="MarginContainer" parent="."] +offset_right = 40.0 +offset_bottom = 40.0 +theme = ExtResource("1_0shvn") + +[node name="VBoxContainer" type="VBoxContainer" parent="MarginContainer"] +unique_name_in_owner = true +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="Label" type="Label" parent="MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "Level Select" +horizontal_alignment = 1 + +[node name="SceneSelect" type="Button" parent="MarginContainer/VBoxContainer" groups=["scene_button"]] +layout_mode = 2 +text = "Title +" +script = ExtResource("2_4d80g") +scene_path = "res://scenes/title_scene/title_scene.tscn" + +[node name="SceneSelect2" type="Button" parent="MarginContainer/VBoxContainer" groups=["scene_button"]] +layout_mode = 2 +text = "Tutorial 1" +script = ExtResource("2_4d80g") +scene_path = "res://scenes/tutorial_scenes/tutorial_scene_1.tscn" + +[node name="SceneSelect3" type="Button" parent="MarginContainer/VBoxContainer" groups=["scene_button"]] +layout_mode = 2 +text = "Tutorial 2" +script = ExtResource("2_4d80g") +scene_path = "res://scenes/tutorial_scenes/tutorial_scene_2.tscn" + +[node name="SceneSelect4" type="Button" parent="MarginContainer/VBoxContainer" groups=["scene_button"]] +layout_mode = 2 +text = "Valentine" +script = ExtResource("2_4d80g") +scene_path = "res://scenes/valentine_scene/valentine_scene.tscn" diff --git a/scenes/level_select_3d.tscn b/scenes/level_select_3d.tscn new file mode 100644 index 0000000..625272e --- /dev/null +++ b/scenes/level_select_3d.tscn @@ -0,0 +1,44 @@ +[gd_scene load_steps=8 format=3 uid="uid://g4esih4vcves"] + +[ext_resource type="PackedScene" uid="uid://clujaf3u776a3" path="res://addons/godot-xr-tools/objects/viewport_2d_in_3d.tscn" id="1_t65qq"] +[ext_resource type="PackedScene" uid="uid://m1twp7r5vtv0" path="res://scenes/level_select.tscn" id="2_ju2uv"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_wt13n"] +shading_mode = 0 + +[sub_resource type="QuadMesh" id="QuadMesh_3x3hc"] +resource_local_to_scene = true +size = Vector2(2, 2) + +[sub_resource type="ViewportTexture" id="ViewportTexture_whqpc"] +viewport_path = NodePath("Viewport") + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ubces"] +shading_mode = 0 +albedo_texture = SubResource("ViewportTexture_whqpc") + +[sub_resource type="BoxShape3D" id="BoxShape3D_803iy"] +resource_local_to_scene = true +size = Vector3(2, 2, 0.02) + +[node name="LevelSelect3D" instance=ExtResource("1_t65qq")] +screen_size = Vector2(2, 2) +scene = ExtResource("2_ju2uv") +viewport_size = Vector2(200, 200) +update_mode = 2 +material = SubResource("StandardMaterial3D_wt13n") +scene_properties_keys = PackedStringArray() + +[node name="Viewport" parent="." index="0"] +size = Vector2i(200, 200) + +[node name="Screen" parent="." index="1"] +mesh = SubResource("QuadMesh_3x3hc") +surface_material_override/0 = SubResource("StandardMaterial3D_ubces") + +[node name="StaticBody3D" parent="." index="2"] +screen_size = Vector2(2, 2) +viewport_size = Vector2(200, 200) + +[node name="CollisionShape3D" parent="StaticBody3D" index="0"] +shape = SubResource("BoxShape3D_803iy") diff --git a/scenes/new_theme.tres b/scenes/new_theme.tres new file mode 100644 index 0000000..5a89628 --- /dev/null +++ b/scenes/new_theme.tres @@ -0,0 +1,15 @@ +[gd_resource type="Theme" load_steps=3 format=3 uid="uid://bfjhdxefw3nxu"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qmc8q"] +bg_color = Color(0.171637, 0.171637, 0.171637, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_icc4y"] +bg_color = Color(0.792047, 0.437933, 0.509316, 1) + +[resource] +Button/styles/normal = SubResource("StyleBoxFlat_qmc8q") +MarginContainer/constants/margin_bottom = 10 +MarginContainer/constants/margin_left = 10 +MarginContainer/constants/margin_right = 10 +MarginContainer/constants/margin_top = 10 +MarginContainer/styles/normal = SubResource("StyleBoxFlat_icc4y") diff --git a/scenes/scene_select_button.gd b/scenes/scene_select_button.gd new file mode 100644 index 0000000..e415328 --- /dev/null +++ b/scenes/scene_select_button.gd @@ -0,0 +1,16 @@ +class_name SceneSelectButton +extends Button + +@export_file('*.tscn') var scene_path : String + +func _ready(): + pressed.connect(_on_pressed) + +func _on_pressed(): + var root = get_tree().current_scene + print("Current scene root: ", root) + if root is XRToolsStaging: + print("Loading scene: ", scene_path) + root.load_scene(scene_path) + else: + print("Root scene is not XRToolsStaging, got: ", root) diff --git a/scenes/title_scene/title_scene.tscn b/scenes/title_scene/title_scene.tscn index 0554b52..e410324 100644 --- a/scenes/title_scene/title_scene.tscn +++ b/scenes/title_scene/title_scene.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=43 format=3 uid="uid://bd86thqpujh3p"] +[gd_scene load_steps=45 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"] @@ -19,6 +19,7 @@ [ext_resource type="PackedScene" uid="uid://bifpsyvpcem3a" path="res://scenes/manipulator/manipulator.tscn" id="17_uqqr1"] [ext_resource type="PackedScene" uid="uid://ccmx5v2601k8q" path="res://scenes/manipulator/visual_attractor_sphere.tscn" id="18_qmvne"] [ext_resource type="PackedScene" uid="uid://cibwlfqvmirgb" path="res://scenes/ambient_particles.tscn" id="19_dlo8s"] +[ext_resource type="PackedScene" uid="uid://m1twp7r5vtv0" path="res://scenes/level_select.tscn" id="20_b65a1"] [sub_resource type="BoxShape3D" id="BoxShape3D_gj4t1"] size = Vector3(100, 100, 100) @@ -145,6 +146,9 @@ size = Vector3(0.2, 0.2, 0.2) emission_enabled = true emission = Color(0.208505, 0.70691, 0.626474, 1) +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6y3wb"] +shading_mode = 0 + [node name="TitleScene" type="Node3D"] script = ExtResource("1_t86sx") @@ -304,3 +308,11 @@ skeleton = NodePath("") surface_material_override/0 = SubResource("StandardMaterial3D_hyt1m") [node name="AmbientParticles" parent="." instance=ExtResource("19_dlo8s")] + +[node name="LevelSelect3D" parent="." instance=ExtResource("13_ab6mb")] +transform = Transform3D(0.866025, 0, 0.5, 0, 1, 0, -0.5, 0, 0.866025, -2.95677, 1.44193, -4.49419) +screen_size = Vector2(2, 2) +scene = ExtResource("20_b65a1") +viewport_size = Vector2(200, 200) +material = SubResource("StandardMaterial3D_6y3wb") +scene_properties_keys = PackedStringArray() diff --git a/scenes/tutorial_scenes/tutorial_scene_1.tscn b/scenes/tutorial_scenes/tutorial_scene_1.tscn index 2bfd69b..118e491 100644 --- a/scenes/tutorial_scenes/tutorial_scene_1.tscn +++ b/scenes/tutorial_scenes/tutorial_scene_1.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=3 uid="uid://dqbxp72mjmbc"] +[gd_scene load_steps=22 format=3 uid="uid://dqbxp72mjmbc"] [ext_resource type="PackedScene" uid="uid://1rwj4eq63xgb" path="res://scenes/tutorial_scenes/tutorial_scene_base.tscn" id="1_lkcbi"] [ext_resource type="VoxelGIData" uid="uid://nuw3xyd4kkpq" path="res://scenes/tutorial_scenes/tutorial_scene_1.VoxelGI_data.res" id="2_4e4av"] @@ -53,6 +53,14 @@ line_spacing = -5.0 pixel_size = 0.02 depth = 0.2 +[sub_resource type="TextMesh" id="TextMesh_kqj8q"] +text = "Level Select +Is Behind You" +horizontal_alignment = 0 +line_spacing = -5.0 +pixel_size = 0.02 +depth = 0.2 + [sub_resource type="TextMesh" id="TextMesh_knbyw"] text = "Grab the Ball To Move @@ -114,19 +122,23 @@ process_material = SubResource("ParticleProcessMaterial_pu2oq") transform = Transform3D(0.787333, 0, 0.616528, 0, 1, 0, -0.616528, 0, 0.787333, -2.04386, 0.522766, -1.73643) mesh = SubResource("TextMesh_0qq7n") -[node name="GrabTheManipulator" type="MeshInstance3D" parent="." index="13"] +[node name="LevelSelect" type="MeshInstance3D" parent="." index="13"] +transform = Transform3D(0.933054, 0, 0.359736, 0, 1, 0, -0.359736, 0, 0.933054, -2.79529, 2.72605, -4.60797) +mesh = SubResource("TextMesh_kqj8q") + +[node name="GrabTheManipulator" type="MeshInstance3D" parent="." index="14"] transform = Transform3D(0.80479, 0, -0.593559, 0, 1, 0, 0.593559, 0, 0.80479, 1.2946, 0.483083, -2.45375) mesh = SubResource("TextMesh_knbyw") -[node name="TheStream" type="MeshInstance3D" parent="." index="14"] +[node name="TheStream" type="MeshInstance3D" parent="." index="15"] transform = Transform3D(0.496262, 0, 0.868173, 0, 1, 0, -0.868173, 0, 0.496262, -2.66182, 1.47005, -1.41463) mesh = SubResource("TextMesh_7pjq2") -[node name="TheTarget" type="MeshInstance3D" parent="." index="15"] +[node name="TheTarget" type="MeshInstance3D" parent="." index="16"] transform = Transform3D(0.996969, 0, -0.0777979, 0, 1, 0, 0.0777979, 0, 0.996969, 0.117968, 2.73322, -2.97752) mesh = SubResource("TextMesh_18ch5") -[node name="Manipulator1" parent="." index="16" groups=["manipulators"] instance=ExtResource("3_pgrk8")] +[node name="Manipulator1" parent="." index="17" groups=["manipulators"] instance=ExtResource("3_pgrk8")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.6837, 1.50178, -2.83406) [node name="VisualAttractorSphere" parent="Manipulator1" index="4" instance=ExtResource("4_05xwa")] @@ -142,7 +154,7 @@ mesh = SubResource("PrismMesh_f1dje") skeleton = NodePath("") surface_material_override/0 = SubResource("StandardMaterial3D_vyhi3") -[node name="Target1" type="StaticBody3D" parent="." index="17" groups=["targets"]] +[node name="Target1" type="StaticBody3D" parent="." index="18" groups=["targets"]] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.91143, 3.59885, -3.13788) script = ExtResource("5_46vbo") diff --git a/scenes/tutorial_scenes/tutorial_scene_2.tscn b/scenes/tutorial_scenes/tutorial_scene_2.tscn index 4140fb7..7211a30 100644 --- a/scenes/tutorial_scenes/tutorial_scene_2.tscn +++ b/scenes/tutorial_scenes/tutorial_scene_2.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=22 format=3 uid="uid://wnfi7j3dmjl"] +[gd_scene load_steps=25 format=3 uid="uid://wnfi7j3dmjl"] [ext_resource type="PackedScene" uid="uid://1rwj4eq63xgb" path="res://scenes/tutorial_scenes/tutorial_scene_base.tscn" id="1_ef0x7"] [ext_resource type="VoxelGIData" uid="uid://nhfw6m8oc1hi" path="res://scenes/tutorial_scenes/tutorial_scene_2.VoxelGI_data.res" id="2_eyu4w"] @@ -86,6 +86,17 @@ emission_energy_multiplier = 0.61 rim = 0.38 refraction_scale = 0.88 +[sub_resource type="BoxMesh" id="BoxMesh_cvybi"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jqpsb"] +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="TextMesh" id="TextMesh_gt0jy"] text = "the target" @@ -103,6 +114,14 @@ line_spacing = -7.0 pixel_size = 0.02 depth = 0.2 +[sub_resource type="TextMesh" id="TextMesh_jioxp"] +text = "Level Select +Is Behind You" +horizontal_alignment = 0 +line_spacing = -5.0 +pixel_size = 0.02 +depth = 0.2 + [node name="TutorialSceneBase" instance=ExtResource("1_ef0x7")] [node name="VoxelGI" parent="." index="4"] @@ -113,7 +132,7 @@ transform = Transform3D(1, 0, 0, 0, 0.798268, 0.602302, 0, -0.602302, 0.798268, [node name="GPUParticles3D" parent="." index="10"] transform = Transform3D(-3.09086e-08, -0.707107, 0.707107, 1, -4.37114e-08, 0, 3.09086e-08, 0.707107, 0.707107, -0.0848585, 0.312401, -3.05504) -lifetime = 3.0 +lifetime = 2.0 process_material = SubResource("ParticleProcessMaterial_c7gdv") [node name="GrabTheWorld" type="MeshInstance3D" parent="." index="12"] @@ -169,9 +188,9 @@ shape = SubResource("BoxShape3D_5cvp1") [node name="MeshInstance3D" type="MeshInstance3D" parent="Target2" index="1"] layers = 4 -mesh = SubResource("BoxMesh_swij7") +mesh = SubResource("BoxMesh_cvybi") skeleton = NodePath("../..") -surface_material_override/0 = SubResource("StandardMaterial3D_w1uvt") +surface_material_override/0 = SubResource("StandardMaterial3D_jqpsb") [node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="Target2" index="2"] stream = ExtResource("7_bmi33") @@ -185,3 +204,7 @@ mesh = SubResource("TextMesh_gt0jy") [node name="TheTarget2" type="MeshInstance3D" parent="." index="18"] transform = Transform3D(0.996969, 0, -0.0777979, 0, 1, 0, 0.0777979, 0, 0.996969, -1.53939, 3.57846, -6.22573) mesh = SubResource("TextMesh_tfnjp") + +[node name="LevelSelect" type="MeshInstance3D" parent="." index="20"] +transform = Transform3D(0.933054, 0, 0.359736, 0, 1, 0, -0.359736, 0, 0.933054, -3.68075, 2.72605, -4.01316) +mesh = SubResource("TextMesh_jioxp") diff --git a/scenes/tutorial_scenes/tutorial_scene_base.tscn b/scenes/tutorial_scenes/tutorial_scene_base.tscn index d18e298..7c345d9 100644 --- a/scenes/tutorial_scenes/tutorial_scene_base.tscn +++ b/scenes/tutorial_scenes/tutorial_scene_base.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=20 format=3 uid="uid://1rwj4eq63xgb"] +[gd_scene load_steps=21 format=3 uid="uid://1rwj4eq63xgb"] [ext_resource type="Script" path="res://scenes/base_game_scene.gd" id="1_lv8qp"] [ext_resource type="PackedScene" uid="uid://7uc6tf2tvn1k" path="res://scenes/xr_origin_3d.tscn" id="2_pnpvr"] @@ -9,6 +9,7 @@ [ext_resource type="Environment" uid="uid://c1yf8e4qr42hr" path="res://scenes/environment.tres" id="8_8na6t"] [ext_resource type="PackedScene" uid="uid://rsrnbs08nv1n" path="res://scenes/collisions/proxy_collision_detector.tscn" id="10_e5fuu"] [ext_resource type="TubeTrailMesh" uid="uid://davtfqjg4wclw" path="res://scenes/tutorial_scenes/tutorial_1_particle_mat.tres" id="10_f6cc6"] +[ext_resource type="PackedScene" uid="uid://g4esih4vcves" path="res://scenes/level_select_3d.tscn" id="10_vjuu6"] [sub_resource type="BoxShape3D" id="BoxShape3D_gj4t1"] size = Vector3(100, 100, 100) @@ -128,3 +129,6 @@ draw_pass_1 = ExtResource("10_f6cc6") [node name="TutorialText" type="MeshInstance3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.07209, -5.05289) mesh = SubResource("TextMesh_1u4xn") + +[node name="LevelSelect3D" parent="." instance=ExtResource("10_vjuu6")] +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1, 2) diff --git a/scenes/valentine_scene/valentine_scene.tscn b/scenes/valentine_scene/valentine_scene.tscn index 74b6451..2d3c1eb 100644 --- a/scenes/valentine_scene/valentine_scene.tscn +++ b/scenes/valentine_scene/valentine_scene.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=38 format=3 uid="uid://4hr2m5ibwhpy"] +[gd_scene load_steps=39 format=3 uid="uid://4hr2m5ibwhpy"] [ext_resource type="Script" path="res://scenes/base_game_scene.gd" id="1_fbwwc"] [ext_resource type="PackedScene" uid="uid://7uc6tf2tvn1k" path="res://scenes/xr_origin_3d.tscn" id="2_i3vfe"] @@ -19,6 +19,7 @@ [ext_resource type="PackedScene" uid="uid://bifpsyvpcem3a" path="res://scenes/manipulator/manipulator.tscn" id="18_wecvv"] [ext_resource type="PackedScene" uid="uid://cibwlfqvmirgb" path="res://scenes/ambient_particles.tscn" id="19_ssw3h"] [ext_resource type="PackedScene" uid="uid://ccmx5v2601k8q" path="res://scenes/manipulator/visual_attractor_sphere.tscn" id="19_xjpkb"] +[ext_resource type="PackedScene" uid="uid://g4esih4vcves" path="res://scenes/level_select_3d.tscn" id="20_l6q7q"] [sub_resource type="BoxShape3D" id="BoxShape3D_gj4t1"] size = Vector3(100, 100, 100) @@ -297,3 +298,6 @@ transform = Transform3D(-4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, 0, 1, 0, 3.1 mesh = SubResource("CylinderMesh_7qhvg") [node name="AmbientParticles" parent="." instance=ExtResource("19_ssw3h")] + +[node name="LevelSelect3D" parent="." instance=ExtResource("20_l6q7q")] +transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 1, 2)