From 0cddcc5ea17d679c51bdcfa3956f05ef04510177 Mon Sep 17 00:00:00 2001 From: Nitwel Date: Sat, 27 Apr 2024 15:58:58 +0200 Subject: [PATCH] how player position in MiniView --- app/content/system/hands/hands.tscn | 8 ++++---- app/content/system/house/mini/miniature.gd | 9 +++++++++ app/content/system/house/mini/miniature.tscn | 15 ++++++++++++++- app/content/ui/components/button/button.tscn | 8 ++++---- app/content/ui/components/input/input.tscn | 8 ++++---- app/content/ui/components/panel/panel.tscn | 8 ++++---- docs/development/interaction.md | 2 +- 7 files changed, 40 insertions(+), 18 deletions(-) diff --git a/app/content/system/hands/hands.tscn b/app/content/system/hands/hands.tscn index b3ecf48..517a26b 100644 --- a/app/content/system/hands/hands.tscn +++ b/app/content/system/hands/hands.tscn @@ -51,7 +51,7 @@ transform = Transform3D(1, -7.45058e-09, -2.22045e-16, 7.45058e-09, 1, 0, 0, 0, shape = SubResource("CapsuleShape3D_dopke") [node name="ThumbTip" type="BoneAttachment3D" parent="XRHandLeft"] -transform = Transform3D(0.937246, 0.0284254, -0.347508, 0.0184905, 0.991216, 0.130949, 0.348178, -0.129157, 0.928487, 0.0498668, 0.0560917, -0.112777) +transform = Transform3D(0.937246, 0.0284254, -0.347508, 0.0184905, 0.991216, 0.130949, 0.348178, -0.129157, 0.928488, 0.0498668, 0.0560917, -0.112777) bone_name = "Thumb_Tip_L" bone_idx = 4 use_external_skeleton = true @@ -61,7 +61,7 @@ external_skeleton = NodePath("../left_hand/Armature_001/Skeleton3D") gizmo_extents = 0.02 [node name="MiddleTip" type="BoneAttachment3D" parent="XRHandLeft"] -transform = Transform3D(0.0812012, -0.650531, -0.755125, 0.996576, 0.064817, 0.051326, 0.0155558, -0.756708, 0.653567, 0.032112, 0.00654224, -0.171612) +transform = Transform3D(0.0812012, -0.650531, -0.755125, 0.996577, 0.064817, 0.051326, 0.0155558, -0.756708, 0.653568, 0.032112, 0.00654224, -0.171612) bone_name = "Middle_Tip_L" bone_idx = 14 use_external_skeleton = true @@ -112,7 +112,7 @@ transform = Transform3D(1, 0, 4.7579e-13, 0, 1, 0, -1.34149e-12, 1.77636e-15, 1, material_override = SubResource("StandardMaterial3D_n27ki") [node name="IndexTip" type="BoneAttachment3D" parent="XRHandRight"] -transform = Transform3D(0.19221, 0.669966, 0.717078, -0.091543, -0.715277, 0.69282, 0.977075, -0.19881, -0.0761527, -0.0345978, -0.164767, -0.0355401) +transform = Transform3D(0.19221, 0.669966, 0.717079, -0.091543, -0.715277, 0.69282, 0.977075, -0.19881, -0.0761527, -0.0345977, -0.164767, -0.0355401) bone_name = "Index_Tip_R" bone_idx = 9 use_external_skeleton = true @@ -142,7 +142,7 @@ external_skeleton = NodePath("../right_hand/Armature/Skeleton3D") gizmo_extents = 0.02 [node name="MiddleTip" type="BoneAttachment3D" parent="XRHandRight"] -transform = Transform3D(0.0812011, 0.650531, 0.755126, -0.0155557, -0.756708, 0.653568, 0.996576, -0.0648169, -0.0513262, -0.032112, -0.171612, -0.00654216) +transform = Transform3D(0.0812011, 0.650531, 0.755126, -0.0155557, -0.756709, 0.653568, 0.996576, -0.0648169, -0.0513262, -0.032112, -0.171612, -0.00654216) bone_name = "Middle_Tip_R" bone_idx = 14 use_external_skeleton = true diff --git a/app/content/system/house/mini/miniature.gd b/app/content/system/house/mini/miniature.gd index 77eedba..8079754 100644 --- a/app/content/system/house/mini/miniature.gd +++ b/app/content/system/house/mini/miniature.gd @@ -8,8 +8,10 @@ const temperature_gradient = preload ("./temp_gradient.tres") @onready var body = $Body @onready var small_node = $Body/Small @onready var model = $Body/Small/Model +@onready var player = $Body/Small/Player @onready var collision_shape = $Body/CollisionShape3D @onready var entity_select = $Body/EntitySelect +@onready var main = $"/root/Main" enum HeatmapType { NONE = 0, @@ -71,6 +73,7 @@ func _ready(): # Update Size R.effect(func(_arg): collision_shape.disabled=small.value == false + player.visible=small.value var tween:=create_tween() tween.set_parallel(true) @@ -131,6 +134,12 @@ func _ready(): wall_material.set_shader_parameter("alpha", opacity.value / 100.0) ) +func _process(delta): + var cam_pos = main.camera.global_position + cam_pos.y += 0.1 + player.mesh.height = cam_pos.y + player.position = Vector3(cam_pos.x, cam_pos.y / 2, cam_pos.z) + const SensorEntity = preload ("res://content/entities/sensor/sensor.gd") func get_base_scale() -> Vector2: diff --git a/app/content/system/house/mini/miniature.tscn b/app/content/system/house/mini/miniature.tscn index f89f869..b59783c 100644 --- a/app/content/system/house/mini/miniature.tscn +++ b/app/content/system/house/mini/miniature.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=3 uid="uid://ds60i5n211hi3"] +[gd_scene load_steps=7 format=3 uid="uid://ds60i5n211hi3"] [ext_resource type="Script" path="res://content/system/house/mini/miniature.gd" id="1_b53yn"] [ext_resource type="Script" path="res://content/functions/movable.gd" id="2_x7oed"] @@ -6,6 +6,15 @@ [sub_resource type="BoxShape3D" id="BoxShape3D_bckw3"] +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_npsgb"] +resource_local_to_scene = true +transparency = 1 +albedo_color = Color(0.404, 0.22, 0.627, 0.5) + +[sub_resource type="CapsuleMesh" id="CapsuleMesh_f3avi"] +radius = 0.3 +height = 1.75 + [node name="Miniature" type="Node3D"] script = ExtResource("1_b53yn") @@ -25,6 +34,10 @@ restricted = true [node name="Dots" type="Node3D" parent="Body/Small"] +[node name="Player" type="MeshInstance3D" parent="Body/Small"] +material_override = SubResource("StandardMaterial3D_npsgb") +mesh = SubResource("CapsuleMesh_f3avi") + [node name="EntitySelect" type="Marker3D" parent="Body"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.757576, 0) gizmo_extents = 0.1 diff --git a/app/content/ui/components/button/button.tscn b/app/content/ui/components/button/button.tscn index 0570053..f18baf5 100644 --- a/app/content/ui/components/button/button.tscn +++ b/app/content/ui/components/button/button.tscn @@ -4,7 +4,7 @@ [ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="2_db5by"] [ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="3_skm86"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_tulmb"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_n8om1"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("2_db5by") @@ -19,7 +19,7 @@ shader_parameter/corner_radius = 0.2 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_hvywi"] +[sub_resource type="QuadMesh" id="QuadMesh_dxm1i"] size = Vector2(0.04, 0.04) [sub_resource type="BoxShape3D" id="BoxShape3D_xwopm"] @@ -42,8 +42,8 @@ collision_mask = 0 [node name="Panel3D" type="MeshInstance3D" parent="Body"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005) -material_override = SubResource("ShaderMaterial_tulmb") -mesh = SubResource("QuadMesh_hvywi") +material_override = SubResource("ShaderMaterial_n8om1") +mesh = SubResource("QuadMesh_dxm1i") skeleton = NodePath("../..") script = ExtResource("3_skm86") size = Vector2(0.04, 0.04) diff --git a/app/content/ui/components/input/input.tscn b/app/content/ui/components/input/input.tscn index e175269..8ecf22b 100644 --- a/app/content/ui/components/input/input.tscn +++ b/app/content/ui/components/input/input.tscn @@ -5,7 +5,7 @@ [ext_resource type="FontVariation" uid="uid://d2ofyimg5s65q" path="res://assets/fonts/ui_font_500.tres" id="3_ij5fh"] [ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="3_nl02b"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_md6kx"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_a00dk"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("3_nl02b") @@ -20,7 +20,7 @@ shader_parameter/corner_radius = 0.2 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_btoa3"] +[sub_resource type="QuadMesh" id="QuadMesh_har6y"] size = Vector2(0.15, 0.03) [sub_resource type="BoxShape3D" id="BoxShape3D_x4yp8"] @@ -83,8 +83,8 @@ collision_mask = 6 [node name="Panel3D" type="MeshInstance3D" parent="Body"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.005) -material_override = SubResource("ShaderMaterial_md6kx") -mesh = SubResource("QuadMesh_btoa3") +material_override = SubResource("ShaderMaterial_a00dk") +mesh = SubResource("QuadMesh_har6y") script = ExtResource("3_3bvrj") size = Vector2(0.15, 0.03) diff --git a/app/content/ui/components/panel/panel.tscn b/app/content/ui/components/panel/panel.tscn index ecf1008..b5cf52a 100644 --- a/app/content/ui/components/panel/panel.tscn +++ b/app/content/ui/components/panel/panel.tscn @@ -3,7 +3,7 @@ [ext_resource type="Script" path="res://content/ui/components/panel/panel.gd" id="1_2jq4a"] [ext_resource type="Shader" path="res://content/ui/components/panel/glass.gdshader" id="1_mpdsy"] -[sub_resource type="ShaderMaterial" id="ShaderMaterial_jbi6t"] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_2wxf7"] resource_local_to_scene = true render_priority = 10 shader = ExtResource("1_mpdsy") @@ -18,12 +18,12 @@ shader_parameter/corner_radius = 0.04 shader_parameter/roughness = 0.3 shader_parameter/grain_amount = 0.02 -[sub_resource type="QuadMesh" id="QuadMesh_vcnnc"] +[sub_resource type="QuadMesh" id="QuadMesh_r8ntw"] size = Vector2(0.04, 0.04) [node name="Panel" type="MeshInstance3D"] -material_override = SubResource("ShaderMaterial_jbi6t") -mesh = SubResource("QuadMesh_vcnnc") +material_override = SubResource("ShaderMaterial_2wxf7") +mesh = SubResource("QuadMesh_r8ntw") script = ExtResource("1_2jq4a") size = Vector2(0.04, 0.04) corner_radius = null diff --git a/docs/development/interaction.md b/docs/development/interaction.md index 1d250eb..04c3992 100644 --- a/docs/development/interaction.md +++ b/docs/development/interaction.md @@ -6,7 +6,7 @@ The app currently supports 3 different types of interaction techniques: - **Using hands with raycast** - **Using hands with direct touch** -The interaction system, like the [Event System](/development/event-system.html), is heavily inspired by the interaction system in browsers. Interaction Events can be broken down into 2 categories, [Pointer Events](/reference/EventPointer.html) initiated by a raycast and [Touch Events](/reference/TouchEvent.html) initiated by a collision shape in the tip of the fingers. Pointer Events](/reference/EventPointer.html) +The interaction system, like the [Event System](/development/event-system.html), is heavily inspired by the interaction system in browsers. Interaction Events can be broken down into 2 categories, [Pointer Events](/reference/EventPointer.html) initiated by a raycast and [Touch Events](/reference/EventTouch.html) initiated by a collision shape in the tip of the fingers. Pointer Events](/reference/EventPointer.html) ## Pointer Events