diff --git a/flatscreen-project/objects/pinned_photo.tscn b/flatscreen-project/objects/pinned_photo.tscn index cb2e302b..2207acc1 100644 --- a/flatscreen-project/objects/pinned_photo.tscn +++ b/flatscreen-project/objects/pinned_photo.tscn @@ -9,6 +9,7 @@ size = Vector2(166, 172) [node name="PinnedPhoto" type="PinnedPhoto"] input_pickable = true +sync_to_physics = false [node name="MeshInstance2D" type="MeshInstance2D" parent="."] position = Vector2(0, 73.49998) diff --git a/flatscreen-project/scenes/workspace.tscn b/flatscreen-project/scenes/workspace.tscn index be09461e..339a5b6d 100644 --- a/flatscreen-project/scenes/workspace.tscn +++ b/flatscreen-project/scenes/workspace.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=13 format=3 uid="uid://o3ri154wpbrx"] +[gd_scene load_steps=15 format=3 uid="uid://o3ri154wpbrx"] [ext_resource type="PackedScene" uid="uid://btcmnw6q6g0h0" path="res://objects/pinned_photo.tscn" id="1_7cefc"] [ext_resource type="PackedScene" uid="uid://qmb60kjx6yoe" path="res://objects/victim_file.tscn" id="2_vo7lu"] @@ -17,14 +17,41 @@ gradient = SubResource("Gradient_usqe2") [sub_resource type="RectangleShape2D" id="RectangleShape2D_87mh6"] size = Vector2(965, 533) -[sub_resource type="RectangleShape2D" id="RectangleShape2D_7cefc"] -size = Vector2(400, 64) - [sub_resource type="QuadMesh" id="QuadMesh_cnvne"] -[sub_resource type="QuadMesh" id="QuadMesh_thvsl"] +[sub_resource type="CircleShape2D" id="CircleShape2D_cnvne"] +radius = 7.280088 -[sub_resource type="ImageTexture" id="ImageTexture_cnvne"] +[sub_resource type="GDScript" id="GDScript_cnvne"] +script/source = "extends Button + +func _ready() -> void: + update_can_send() + +func _pressed() -> void: + if ServerNode.get_singleton(): + ServerNode.get_singleton().send_conclusion(%WeaponSlot.get_current_clue(), %MotiveSlot.get_current_clue(), %MurdererSlot.get_current_clue()) + else: + print(\"Conclusion: \", %WeaponSlot.get_current_clue(), \", \", %MotiveSlot.get_current_clue(), \", \", %MurdererSlot.get_current_clue()) + +func update_can_send(): + self.disabled = not (%WeaponSlot.is_filled() and %MotiveSlot.is_filled() and %MurdererSlot.is_filled()) + +func _on_any_slot_selection_changed(_new_value: int) -> void: + update_can_send() +" + +[sub_resource type="TextMesh" id="TextMesh_cnvne"] +flip_faces = true +text = "Method, Motive, Murderer" +depth = 0.0 + +[sub_resource type="Gradient" id="Gradient_thvsl"] +offsets = PackedFloat32Array(0) +colors = PackedColorArray(0, 0, 0, 1) + +[sub_resource type="GradientTexture1D" id="GradientTexture1D_c1nar"] +gradient = SubResource("Gradient_thvsl") [node name="FlatscreenRoot" type="Node2D"] @@ -32,7 +59,7 @@ size = Vector2(400, 64) anchor_mode = 0 [node name="Pinboard" type="Pinboard" parent="."] -position = Vector2(312, 19) +position = Vector2(109, 19) [node name="MeshInstance2D" type="MeshInstance2D" parent="Pinboard"] position = Vector2(794.49994, 417) @@ -44,9 +71,62 @@ texture = SubResource("GradientTexture1D_87mh6") position = Vector2(636.5, 465.5) shape = SubResource("RectangleShape2D_87mh6") -[node name="CollisionShape2D2" type="CollisionShape2D" parent="Pinboard"] -position = Vector2(1340, 701) -shape = SubResource("RectangleShape2D_7cefc") +[node name="Handin" type="Node2D" parent="."] +position = Vector2(1899.9999, -15) +rotation = -0.042017065 + +[node name="MeshInstance2D" type="MeshInstance2D" parent="Handin"] +position = Vector2(-276.4963, 370.27814) +scale = Vector2(553.9857, 740.51447) +mesh = SubResource("QuadMesh_cnvne") + +[node name="TextEdit" type="TextEdit" parent="Handin"] +offset_left = -508.21082 +offset_top = 553.0962 +offset_right = -24.305176 +offset_bottom = 714.85803 +backspace_deletes_composite_character_enabled = true +wrap_mode = 1 + +[node name="WeaponSlot" type="ConclusionField" parent="Handin"] +unique_name_in_owner = true +position = Vector2(-448.5945, 290.4132) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Handin/WeaponSlot"] +position = Vector2(0, 43.237) +shape = SubResource("CircleShape2D_cnvne") + +[node name="MotiveSlot" type="ConclusionField" parent="Handin"] +unique_name_in_owner = true +position = Vector2(-268.54337, 292.97845) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Handin/MotiveSlot"] +position = Vector2(0, 43.237) +shape = SubResource("CircleShape2D_cnvne") + +[node name="MurdererSlot" type="ConclusionField" parent="Handin"] +unique_name_in_owner = true +position = Vector2(-99.188446, 288.08786) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Handin/MurdererSlot"] +position = Vector2(0, 43.237) +shape = SubResource("CircleShape2D_cnvne") + +[node name="SubmitButton" type="Button" parent="Handin"] +unique_name_in_owner = true +offset_left = -307.37988 +offset_top = 502.53214 +offset_right = -230.37988 +offset_bottom = 533.5321 +text = "Submit" +script = SubResource("GDScript_cnvne") + +[node name="MeshInstance2D2" type="MeshInstance2D" parent="Handin"] +position = Vector2(-273.59598, 222.70421) +rotation = 3.1415927 +scale = Vector2(-236.09602, 249.81453) +mesh = SubResource("TextMesh_cnvne") +texture = SubResource("GradientTexture1D_c1nar") [node name="PhotosParent" type="Node2D" parent="."] @@ -76,25 +156,6 @@ open_position = NodePath("../FilePositionTarget") position = Vector2(678.00006, 63.999996) rotation = -0.0034519732 -[node name="Handin" type="Node2D" parent="."] -position = Vector2(1544.9998, 15) -rotation = -0.042017065 - -[node name="MeshInstance2D" type="MeshInstance2D" parent="Handin"] -position = Vector2(169.87817, 238.88794) -scale = Vector2(390.23935, 519.97754) -mesh = SubResource("QuadMesh_cnvne") - -[node name="TextEdit" type="TextEdit" parent="Handin"] -offset_left = 3.0 -offset_top = 344.75198 -offset_right = 342.7721 -offset_bottom = 485.0 -backspace_deletes_composite_character_enabled = true -wrap_mode = 1 - -[node name="MeshInstance2D2" type="MeshInstance2D" parent="Handin"] -position = Vector2(296.84607, 57.51972) -scale = Vector2(97.55189, 112.9032) -mesh = SubResource("QuadMesh_thvsl") -texture = SubResource("ImageTexture_cnvne") +[connection signal="selection_changed" from="Handin/WeaponSlot" to="Handin/SubmitButton" method="_on_any_slot_selection_changed"] +[connection signal="selection_changed" from="Handin/MotiveSlot" to="Handin/SubmitButton" method="_on_any_slot_selection_changed"] +[connection signal="selection_changed" from="Handin/MurdererSlot" to="Handin/SubmitButton" method="_on_any_slot_selection_changed"] diff --git a/modules/you_done_it/client_node.cpp b/modules/you_done_it/client_node.cpp index 4726dbb8..9760abd5 100644 --- a/modules/you_done_it/client_node.cpp +++ b/modules/you_done_it/client_node.cpp @@ -1,5 +1,6 @@ #include "client_node.h" #include "core/config/engine.h" +#include "scene/main/node.h" #include "you_done_it/clue_data.h" #include "you_done_it/clue_db.h" #include "you_done_it/ydi_client.h" @@ -54,6 +55,19 @@ void ClientNode::_notification(int what) { if (Engine::get_singleton()->is_editor_hint()) { return; } + switch (what) { + default: + return; + case NOTIFICATION_ENTER_TREE: + set_process(true); + return; + case NOTIFICATION_PROCESS: + process(); + return; + case NOTIFICATION_EXIT_TREE: + exit_tree(); + return; + } } ClientNode *ClientNode::get_singleton() { diff --git a/modules/you_done_it/conclusion_field.cpp b/modules/you_done_it/conclusion_field.cpp new file mode 100644 index 00000000..54727ade --- /dev/null +++ b/modules/you_done_it/conclusion_field.cpp @@ -0,0 +1,66 @@ +#include "conclusion_field.h" +#include "core/config/engine.h" +#include "you_done_it/pinned_photo.h" +#include "you_done_it/ydi_networking.h" + +String const ConclusionField::sig_selection_changed{ "selection_changed" }; + +void ConclusionField::_bind_methods() { + ADD_SIGNAL(MethodInfo(sig_selection_changed, PropertyInfo(Variant::INT, "new_value", PROPERTY_HINT_ENUM, NetworkData::ClueID_hint()))); + ClassDB::bind_method(D_METHOD("is_filled"), &self_type::is_filled); + ClassDB::bind_method(D_METHOD("get_current_clue"), &self_type::get_current_clue); +} + +void ConclusionField::enter_tree() { + connect("body_entered", callable_mp(this, &self_type::on_body_entered)); + connect("body_exited", callable_mp(this, &self_type::on_body_exited)); +} + +void ConclusionField::on_body_entered(Node2D *node) { + if (PinnedPhoto * photo{ cast_to(node) }) { + photo->push_conclusion_slot(this); + } +} + +void ConclusionField::on_body_exited(Node2D *node) { + if (PinnedPhoto * photo{ cast_to(node) }) { + photo->pull_conclusion_slot(this); + } +} + +void ConclusionField::_notification(int what) { + if (Engine::get_singleton()->is_editor_hint()) { + return; + } + switch (what) { + default: + return; + case NOTIFICATION_ENTER_TREE: + enter_tree(); + return; + } +} + +void ConclusionField::notify_photo_dropped(PinnedPhoto *photo) { + this->photo = photo; + emit_signal(sig_selection_changed, this->photo->get_clue()); +} + +void ConclusionField::notify_photo_picked(PinnedPhoto *photo) { + if (photo == this->photo) { + this->photo = nullptr; + emit_signal(sig_selection_changed, NetworkData::CLUE_MAX); + } +} + +bool ConclusionField::is_filled() const { + return this->photo; +} + +NetworkData::ClueID ConclusionField::get_current_clue() const { + if (!this->photo) { + return NetworkData::CLUE_MAX; + } else { + return photo->get_clue(); + } +} diff --git a/modules/you_done_it/conclusion_field.h b/modules/you_done_it/conclusion_field.h new file mode 100644 index 00000000..465b261c --- /dev/null +++ b/modules/you_done_it/conclusion_field.h @@ -0,0 +1,26 @@ +#pragma once + +#include "scene/2d/physics/area_2d.h" +#include "you_done_it/ydi_networking.h" +class PinnedPhoto; + +class ConclusionField : public Area2D { + GDCLASS(ConclusionField, Area2D); + static void _bind_methods(); + void enter_tree(); + void on_body_entered(Node2D *body); + void on_body_exited(Node2D *body); + +protected: + void _notification(int what); + +public: + void notify_photo_dropped(PinnedPhoto *photo); + void notify_photo_picked(PinnedPhoto *photo); + bool is_filled() const; + NetworkData::ClueID get_current_clue() const; + +private: + PinnedPhoto *photo{ nullptr }; + static String const sig_selection_changed; +}; diff --git a/modules/you_done_it/pinned_photo.cpp b/modules/you_done_it/pinned_photo.cpp index 2c4a056b..840bffbf 100644 --- a/modules/you_done_it/pinned_photo.cpp +++ b/modules/you_done_it/pinned_photo.cpp @@ -4,6 +4,7 @@ #include "macros.h" #include "scene/2d/mesh_instance_2d.h" #include "you_done_it/clue_db.h" +#include "you_done_it/conclusion_field.h" void PinnedPhoto::_bind_methods() { BIND_PROPERTY(Variant::BOOL, can_drop); @@ -29,20 +30,31 @@ void PinnedPhoto::process(double delta) { void PinnedPhoto::on_input_event(Viewport *viewport, Ref event, int shape) { Ref button{ event }; - if (button.is_valid() && button->is_pressed()) { + if (!this->is_held && button.is_valid() && button->is_pressed()) { this->is_held = true; viewport->set_input_as_handled(); + if (this->conclusion_field) { + this->conclusion_field->notify_photo_picked(this); + this->conclusion_field = nullptr; + } } } void PinnedPhoto::unhandled_input(Ref const &event) { - if (!this->is_held) { - return; - } Ref button{ event }; - if (button.is_valid() && this->can_drop && button->is_released()) { - this->is_held = false; - get_viewport()->set_input_as_handled(); + if (this->is_held && button.is_valid() && button->is_released()) { + if (!this->near_fields.is_empty()) { + this->is_held = false; + this->conclusion_field = this->near_fields[this->near_fields.size() - 1]; + this->conclusion_field->notify_photo_dropped(this); + get_viewport()->set_input_as_handled(); + set_global_position(this->conclusion_field->get_global_position()); + set_global_rotation(this->conclusion_field->get_global_rotation()); + } else if (this->can_drop) { + this->is_held = false; + get_viewport()->set_input_as_handled(); + set_global_rotation(0.0); + } } } @@ -65,6 +77,14 @@ void PinnedPhoto::_notification(int what) { } } +void PinnedPhoto::push_conclusion_slot(ConclusionField *field) { + this->near_fields.push_back(field); +} + +void PinnedPhoto::pull_conclusion_slot(ConclusionField *field) { + this->near_fields.erase(field); +} + void PinnedPhoto::set_can_drop(bool value) { this->can_drop = value; } diff --git a/modules/you_done_it/pinned_photo.h b/modules/you_done_it/pinned_photo.h index e575f7b9..c2c16ed4 100644 --- a/modules/you_done_it/pinned_photo.h +++ b/modules/you_done_it/pinned_photo.h @@ -4,7 +4,8 @@ #include "scene/2d/mesh_instance_2d.h" #include "scene/2d/physics/animatable_body_2d.h" #include "scene/main/viewport.h" -#include "ydi_networking.h" +#include "you_done_it/ydi_networking.h" +class ConclusionField; class PinnedPhoto : public AnimatableBody2D { GDCLASS(PinnedPhoto, AnimatableBody2D); @@ -19,6 +20,8 @@ protected: void _notification(int what); public: + void push_conclusion_slot(ConclusionField *field); + void pull_conclusion_slot(ConclusionField *field); void set_can_drop(bool value); bool get_can_drop() const; void set_clue(NetworkData::ClueID id); @@ -29,4 +32,6 @@ private: NetworkData::ClueID clue{ NetworkData::CLUE_MAX }; bool can_drop{ false }; bool is_held{ false }; + ConclusionField *conclusion_field{}; + Vector near_fields{}; }; diff --git a/modules/you_done_it/register_types.cpp b/modules/you_done_it/register_types.cpp index c82312a7..793fa519 100644 --- a/modules/you_done_it/register_types.cpp +++ b/modules/you_done_it/register_types.cpp @@ -5,6 +5,7 @@ #include "you_done_it/clue_data.h" #include "you_done_it/clue_finder.h" #include "you_done_it/clue_marker.h" +#include "you_done_it/conclusion_field.h" #include "you_done_it/file_popup.h" #include "you_done_it/photo_inbox.h" #include "you_done_it/pinboard.h" @@ -29,6 +30,7 @@ void initialize_you_done_it_module(ModuleInitializationLevel p_level) { ClassDB::register_class(); ClassDB::register_class(); ClassDB::register_class(); + ClassDB::register_class(); } void uninitialize_you_done_it_module(ModuleInitializationLevel p_level) { diff --git a/modules/you_done_it/server_node.cpp b/modules/you_done_it/server_node.cpp index dde038ef..c3f90b34 100644 --- a/modules/you_done_it/server_node.cpp +++ b/modules/you_done_it/server_node.cpp @@ -15,6 +15,7 @@ void ServerNode::_bind_methods() { ClassDB::bind_method(D_METHOD("open"), &self_type::open); ClassDB::bind_method(D_METHOD("close"), &self_type::close); ClassDB::bind_method(D_METHOD("is_open"), &self_type::is_open); + ClassDB::bind_method(D_METHOD("send_conclusion", "method", "motive", "murderer"), &self_type::send_conclusion); ClassDB::bind_static_method(self_type::get_class_static(), "get_singleton", &self_type::get_singleton); } @@ -75,6 +76,10 @@ ServerNode *ServerNode::get_singleton() { return singleton_instance; } +void ServerNode::send_conclusion(NetworkData::ClueID method, NetworkData::ClueID motive, NetworkData::ClueID murderer) { + ydi::server::send::conclusion(method, motive, murderer); +} + bool ServerNode::open() { return ydi::server::open(); } diff --git a/modules/you_done_it/server_node.h b/modules/you_done_it/server_node.h index c522354a..06e58f7f 100644 --- a/modules/you_done_it/server_node.h +++ b/modules/you_done_it/server_node.h @@ -1,6 +1,7 @@ #pragma once #include "scene/main/node.h" +#include "you_done_it/ydi_networking.h" class ServerNode : public Node { GDCLASS(ServerNode, Node); @@ -15,6 +16,7 @@ protected: public: static ServerNode *get_singleton(); + void send_conclusion(NetworkData::ClueID method, NetworkData::ClueID motive, NetworkData::ClueID murderer); bool open(); void close(); bool is_open() const; diff --git a/modules/you_done_it/ydi_client.cpp b/modules/you_done_it/ydi_client.cpp index d5b51cfc..b806e528 100644 --- a/modules/you_done_it/ydi_client.cpp +++ b/modules/you_done_it/ydi_client.cpp @@ -34,8 +34,6 @@ void handle_ok(zmq::multipart_t const &message) { } void handle_message(zmq::multipart_t const &message) { - print_line("Client handle_message:"); - print_message_contents(message); NetworkData::MessageType type{ to_message_type(message[0]) }; switch (type) { case NetworkData::MSG_OK: @@ -43,11 +41,11 @@ void handle_message(zmq::multipart_t const &message) { handle_ok(message); return; case NetworkData::MSG_HEART: - print_line("Client: Received HEART, sending BEAT"); multipart(NetworkData::MSG_BEAT).send(*connection->socket); return; default: - print_line("Client: Message not handled"); + print_line("Client: Message not handled:"); + print_message_contents(message); return; } } @@ -132,12 +130,18 @@ void disconnect() { } NetworkData::ConnectionStatus status() { - return connection ? NetworkData::ConnectionStatus(connection->status) : NetworkData::CONNECTION_DISCONNECTED; + if (!connection) { + return NetworkData::CONNECTION_DISCONNECTED; + } else { + std::scoped_lock lock{ connection->mtx }; + return connection->status; + } } namespace send { void reveal_clue(NetworkData::ClueID id) { if (connection) { + print_line("Sending Clue ", id); std::scoped_lock lock{ connection->mtx }; multipart(NetworkData::MSG_REVEAL, id).send(*connection->socket); } else { diff --git a/modules/you_done_it/ydi_networking.h b/modules/you_done_it/ydi_networking.h index fc08d487..22241008 100644 --- a/modules/you_done_it/ydi_networking.h +++ b/modules/you_done_it/ydi_networking.h @@ -23,6 +23,7 @@ public: MSG_BEAT, // gameplay messages MSG_REVEAL, + MSG_CONCLUSION, // end of messages MSG_INVALID); diff --git a/modules/you_done_it/ydi_server.cpp b/modules/you_done_it/ydi_server.cpp index cc768388..23a5100c 100644 --- a/modules/you_done_it/ydi_server.cpp +++ b/modules/you_done_it/ydi_server.cpp @@ -35,7 +35,6 @@ void handle_reveal_clue(zmq::multipart_t const &message) { void handle_authorised_message(std::string_view const &sender, NetworkData::MessageType type, zmq::multipart_t &message) { switch (type) { case NetworkData::MSG_BEAT: - print_line("Server: Received beat, storing timestamp"); service->lastBeat = Time::get_singleton()->get_unix_time_from_system(); return; case NetworkData::MSG_REVEAL: @@ -44,6 +43,7 @@ void handle_authorised_message(std::string_view const &sender, NetworkData::Mess return; default: print_line("Server: Encountered unknown message type, sending NOK_UNKNOWN_MSG response"); + print_message_contents(message); multipart(sender, NetworkData::MSG_NOK, NetworkData::NOK_UNKNOWN_MSG, message).send(*service->socket); return; } @@ -60,15 +60,12 @@ void ping_thread_entry() { while (!service->stop_threads) { std::this_thread::sleep_for(1s); std::scoped_lock lock{ service->mtx }; - print_line("Server: Send HEART"); multipart(*service->client, NetworkData::MSG_HEART).send(*service->socket); service->lastHeart = Time::get_singleton()->get_unix_time_from_system(); } } void handle_message(zmq::multipart_t &message) { - print_line("Server handle_message:"); - print_message_contents(message); std::string_view const sender{ message.at(0).to_string_view() }; NetworkData::MessageType type{ to_message_type(message.at(1)) }; std::scoped_lock lock{ service->mtx }; @@ -196,4 +193,13 @@ bool new_clues(Vector &out) { return has_new; } } //namespace receive +namespace send { +void conclusion(NetworkData::ClueID method, NetworkData::ClueID motive, NetworkData::ClueID murderer) { + if (!service) { + return; + } + std::scoped_lock lock{ service->mtx }; + multipart(*service->client, NetworkData::MSG_CONCLUSION, method, motive, murderer).send(*service->socket); +} +} //namespace send } //namespace ydi::server diff --git a/modules/you_done_it/ydi_server.h b/modules/you_done_it/ydi_server.h index a8683324..5ca1e1b4 100644 --- a/modules/you_done_it/ydi_server.h +++ b/modules/you_done_it/ydi_server.h @@ -13,4 +13,7 @@ bool is_running(); namespace receive { bool new_clues(Vector &out); } //namespace receive +namespace send { +void conclusion(NetworkData::ClueID method, NetworkData::ClueID motive, NetworkData::ClueID murderer); +} } //namespace ydi::server diff --git a/vr-project/3D Models/VR Hand Left.blend.import b/vr-project/3D Models/VR Hand Left.blend.import new file mode 100644 index 00000000..19519047 --- /dev/null +++ b/vr-project/3D Models/VR Hand Left.blend.import @@ -0,0 +1,59 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://be2i5t47efh3w" +path="res://.godot/imported/VR Hand Left.blend-48513c82aee08ea7f00c25b20ce57aa0.scn" + +[deps] + +source_file="res://3D Models/VR Hand Left.blend" +dest_files=["res://.godot/imported/VR Hand Left.blend-48513c82aee08ea7f00c25b20ce57aa0.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +blender/nodes/visible=0 +blender/nodes/active_collection_only=false +blender/nodes/punctual_lights=true +blender/nodes/cameras=true +blender/nodes/custom_properties=true +blender/nodes/modifiers=1 +blender/meshes/colors=false +blender/meshes/uvs=true +blender/meshes/normals=true +blender/meshes/export_geometry_nodes_instances=false +blender/meshes/tangents=true +blender/meshes/skins=2 +blender/meshes/export_bones_deforming_mesh_only=false +blender/materials/unpack_enabled=true +blender/materials/export_materials=1 +blender/animation/limit_playback=true +blender/animation/always_sample=true +blender/animation/group_tracks=true +gltf/naming_version=2 diff --git a/vr-project/3D Models/VR Hand Right.blend.import b/vr-project/3D Models/VR Hand Right.blend.import new file mode 100644 index 00000000..cc4f1e30 --- /dev/null +++ b/vr-project/3D Models/VR Hand Right.blend.import @@ -0,0 +1,59 @@ +[remap] + +importer="scene" +importer_version=1 +type="PackedScene" +uid="uid://16mdrd1edwtj" +path="res://.godot/imported/VR Hand Right.blend-3a895814cf75bf835ed1651de19f1f91.scn" + +[deps] + +source_file="res://3D Models/VR Hand Right.blend" +dest_files=["res://.godot/imported/VR Hand Right.blend-3a895814cf75bf835ed1651de19f1f91.scn"] + +[params] + +nodes/root_type="" +nodes/root_name="" +nodes/root_script=null +nodes/apply_root_scale=true +nodes/root_scale=1.0 +nodes/import_as_skeleton_bones=false +nodes/use_name_suffixes=true +nodes/use_node_type_suffixes=true +meshes/ensure_tangents=true +meshes/generate_lods=true +meshes/create_shadow_meshes=true +meshes/light_baking=1 +meshes/lightmap_texel_size=0.2 +meshes/force_disable_compression=false +skins/use_named_skins=true +animation/import=true +animation/fps=30 +animation/trimming=false +animation/remove_immutable_tracks=true +animation/import_rest_as_RESET=false +import_script/path="" +materials/extract=0 +materials/extract_format=0 +materials/extract_path="" +_subresources={} +blender/nodes/visible=0 +blender/nodes/active_collection_only=false +blender/nodes/punctual_lights=true +blender/nodes/cameras=true +blender/nodes/custom_properties=true +blender/nodes/modifiers=1 +blender/meshes/colors=false +blender/meshes/uvs=true +blender/meshes/normals=true +blender/meshes/export_geometry_nodes_instances=false +blender/meshes/tangents=true +blender/meshes/skins=2 +blender/meshes/export_bones_deforming_mesh_only=false +blender/materials/unpack_enabled=true +blender/materials/export_materials=1 +blender/animation/limit_playback=true +blender/animation/always_sample=true +blender/animation/group_tracks=true +gltf/naming_version=2 diff --git a/vr-project/project.godot b/vr-project/project.godot index af7a8f7d..d516fb78 100644 --- a/vr-project/project.godot +++ b/vr-project/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="you_done_it" -run/main_scene="uid://b5m5h30gog3pu" +run/main_scene="uid://cj8weoqksmfm6" config/features=PackedStringArray("4.5", "Forward Plus") config/icon="res://icon.svg" diff --git a/vr-project/scenes/game_root.tscn b/vr-project/scenes/game_root.tscn new file mode 100644 index 00000000..612046e7 --- /dev/null +++ b/vr-project/scenes/game_root.tscn @@ -0,0 +1,65 @@ +[gd_scene load_steps=4 format=3 uid="uid://cj8weoqksmfm6"] + +[ext_resource type="PackedScene" uid="uid://b5m5h30gog3pu" path="res://scenes/game_scene.tscn" id="1_78s5d"] + +[sub_resource type="GDScript" id="GDScript_78s5d"] +script/source = "extends Node + +@export var game_scene : PackedScene + +func _on_client_node_connection_changed(connected: int) -> void: + print(\"CONNECTION CHANGED: \", connected) + if connected == NetworkData.CONNECTION_AUTHENTICATED: + var instance = game_scene.instantiate() + if instance: + $PanelContainer.queue_free() + add_child(instance) +" + +[sub_resource type="GDScript" id="GDScript_xkpyy"] +script/source = "extends VBoxContainer + +func _on_line_edit_text_submitted(new_text: String) -> void: + %ClientNode.connect_to_server(new_text) + +func _on_button_pressed() -> void: + %ClientNode.connect_to_server($LineEdit.text) +" + +[node name="GameRoot" type="Node"] +script = SubResource("GDScript_78s5d") +game_scene = ExtResource("1_78s5d") + +[node name="ClientNode" type="ClientNode" parent="."] +unique_name_in_owner = true + +[node name="PanelContainer" type="PanelContainer" parent="."] +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="CenterContainer" type="CenterContainer" parent="PanelContainer"] +layout_mode = 2 + +[node name="AspectRatioContainer" type="AspectRatioContainer" parent="PanelContainer/CenterContainer"] +layout_mode = 2 +ratio = 4.127 +stretch_mode = 1 + +[node name="VBoxContainer" type="VBoxContainer" parent="PanelContainer/CenterContainer/AspectRatioContainer"] +layout_mode = 2 +script = SubResource("GDScript_xkpyy") + +[node name="LineEdit" type="LineEdit" parent="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer"] +layout_mode = 2 +placeholder_text = "IP Address" + +[node name="Button" type="Button" parent="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer"] +layout_mode = 2 +text = "Connect" + +[connection signal="connection_changed" from="ClientNode" to="." method="_on_client_node_connection_changed"] +[connection signal="text_submitted" from="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer/LineEdit" to="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer" method="_on_line_edit_text_submitted"] +[connection signal="pressed" from="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer/Button" to="PanelContainer/CenterContainer/AspectRatioContainer/VBoxContainer" method="_on_button_pressed"] diff --git a/vr-project/scenes/game_scene.tscn b/vr-project/scenes/game_scene.tscn index 2040562e..90fb80d3 100644 --- a/vr-project/scenes/game_scene.tscn +++ b/vr-project/scenes/game_scene.tscn @@ -73,8 +73,13 @@ shadow_blur = 1.476 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.27989578, 0, 1.4924412) [node name="ClueMarker" type="ClueMarker" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.2472578, 0.96516895, 2.9078503) clue_id = 0 +[node name="ClueMarker2" type="ClueMarker" parent="."] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.1681437, 0.93944424, 2.9801283) +clue_id = 1 + [node name="Stapler" parent="." instance=ExtResource("3_ycayy")] transform = Transform3D(-1.8868132, 0, -1.8585076, 0, 2.6484175, 0, 1.8585076, 0, -1.8868132, -1.2748423, 0.9004388, 2.876501) diff --git a/vr-project/vr_base.tscn b/vr-project/vr_base.tscn index d9b06c8e..70e1c9fd 100644 --- a/vr-project/vr_base.tscn +++ b/vr-project/vr_base.tscn @@ -9,8 +9,6 @@ height = 0.05 [node name="VROrigin" type="VROrigin"] -[node name="ClientNode" type="ClientNode" parent="."] - [node name="XRCamera3D" type="XRCamera3D" parent="."] current = true