Improved socket script and added hologram logic to show preview of where the pickupable will attach. Also added lock and key meshes.

This commit is contained in:
2026-10-06 20:38:30 +03:00
parent 7267569e6d
commit e6c25cf251
8 changed files with 247 additions and 65 deletions
+62 -12
View File
@@ -1,32 +1,82 @@
[gd_scene format=3 uid="uid://dknge5384ijcx"]
[ext_resource type="Script" uid="uid://b143brnl7gf4f" path="res://Scripts/Pickupable.gd" id="1_rsor3"]
[sub_resource type="BoxShape3D" id="BoxShape3D_1blfk"]
size = Vector3(0.1, 0.1, 0.2)
[sub_resource type="BoxMesh" id="BoxMesh_va8t4"]
size = Vector3(0.1, 0.1, 0.3)
[ext_resource type="ArrayMesh" uid="uid://d12dor1swnt0b" path="res://Meshes/KeyMesh.tres" id="2_w4i4f"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_w4i4f"]
albedo_color = Color(1, 1, 0, 1)
[node name="SimpleKey" type="Node3D" unique_id=650555678 node_paths=PackedStringArray("body", "snapAnchor")]
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_w4i4f"]
points = PackedVector3Array(0.2587716, -0.12591924, -0.03817381, 0.24755853, 0.15451507, 0.02913095, 0.23633888, 0.15451507, 0.02913095, 0.23633888, -0.13713889, 0.02913095, 0.23633888, 0.15451507, -0.03817381, 0.26999125, 0.12085611, 0.02913095, 0.26999125, 0.12085611, -0.03817381, 0.26999125, -0.10347992, 0.02913095, 0.23633888, -0.13713889, -0.03817381, 0.26999125, -0.10347992, -0.03817381, 0.24755853, -0.13713889, 0.02913095, 0.2587716, 0.14329542, -0.03817381, 0.24755853, -0.13713889, -0.03817381, 0.24755853, 0.15451507, -0.03817381, 0.2587716, -0.12591924, 0.02913095, 0.2587716, 0.14329542, 0.02913095)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_ycjx8"]
points = PackedVector3Array(0.23633888, 0.17694777, 0.02913095, 0.10172936, -0.14829704, -0.03817381, 0.11295561, -0.15957159, -0.03817381, 0.10172936, -0.14829704, 0.02913095, 0.10172936, 0.16571055, -0.03817381, 0.23633888, -0.15957159, -0.03817381, 0.23633888, -0.15957159, 0.02913095, 0.23633888, 0.17694777, -0.03817381, 0.10172936, 0.16571055, 0.02913095, 0.14662117, 0.1993849, -0.03817381, 0.14662117, -0.18200871, 0.02913095, 0.2026865, 0.1993849, 0.02913095, 0.2026865, -0.18200871, -0.03817381, 0.14662117, 0.1993849, 0.02913095, 0.2026865, -0.18200871, 0.02913095, 0.14662117, -0.18200871, -0.03817381, 0.2026865, 0.1993849, -0.03817381, 0.12418185, 0.18814766, -0.03817381, 0.12418185, -0.17077148, 0.02913095, 0.12418185, 0.18814766, 0.02913095, 0.22511265, -0.17077148, 0.02913095, 0.22511265, 0.18814766, -0.03817381, 0.12418185, -0.17077148, -0.03817381, 0.22511265, -0.17077148, -0.03817381, 0.22511265, 0.18814766, 0.02913095)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_qtgaf"]
points = PackedVector3Array(0.07929663, -0.10346894, -0.03817381, 0.10172716, 0.14329761, 0.02913095, 0.10172716, 0.14329761, -0.03817381, 0.10172716, -0.12592143, 0.02913095, 0.07929663, 0.120845124, 0.02913095, 0.10172716, -0.12592143, -0.03817381, 0.07929663, 0.120845124, -0.03817381, 0.07929663, -0.10346894, 0.02913095, 0.0905108, -0.12592143, 0.02913095, 0.0905108, 0.14329761, -0.03817381, 0.0905108, -0.12592143, -0.03817381, 0.0905108, 0.14329761, 0.02913095)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_kcr48"]
points = PackedVector3Array(0.26999125, -0.058616668, -0.03817381, 0.28120872, 0.07599285, 0.02913095, 0.26999125, 0.07599285, 0.02913095, 0.28120872, -0.058616668, 0.02913095, 0.28120872, 0.07599285, -0.03817381, 0.26999125, 0.07599285, -0.03817381, 0.26999125, -0.058616668, 0.02913095, 0.28120872, -0.058616668, -0.03817381)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_4nhs8"]
points = PackedVector3Array(0.06807698, -0.06983413, -0.03817381, 0.07929444, 0.08721031, 0.02913095, 0.06807698, 0.08721031, 0.02913095, 0.07929444, -0.06983413, 0.02913095, 0.07929444, 0.08721031, -0.03817381, 0.06807698, 0.08721031, -0.03817381, 0.06807698, -0.06983413, 0.02913095, 0.07929444, -0.06983413, -0.03817381)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_k8bjv"]
points = PackedVector3Array(0.056859523, 0.019900061, -0.026956353, 0.06807589, 0.05354915, 0.01791349, 0.06807589, 0.06477539, 0.0066960296, 0.06807589, -0.036181748, -0.015734501, 0.056859523, -0.036181748, 0.01791349, 0.056859523, 0.05354915, 0.01791349, 0.06807589, -0.036181748, 0.01791349, 0.06807589, 0.019900061, -0.026956353, 0.056859523, -0.036181748, -0.015734501, 0.056859523, 0.06477539, -0.0045214314, 0.06807589, 0.05354915, -0.015734501, 0.056859523, 0.05354915, -0.015734501, 0.06807589, 0.008703465, -0.026956353)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_thc0q"]
points = PackedVector3Array(-0.089002594, -0.047399208, 0.029121067, -0.27966428, 0.0647721, -0.015725713, -0.089002594, -0.013724867, -0.06060873, -0.27966428, -0.013724867, 0.051562577, -0.27966428, -0.036178455, -0.026946466, 0.056859523, -0.0025161915, 0.029121067, -0.089002594, 0.031121913, 0.06278333, 0.056859523, -0.036178455, -0.015725713, 0.056859523, 0.0647721, -0.0045170374, -0.089002594, 0.04233059, -0.06060873, -0.27966428, 0.053551342, 0.040329743, -0.27966428, 0.031121913, -0.049387977, -0.055337038, -0.036178455, 0.051562577, -0.089002594, 0.07599285, 0.017900314, -0.089002594, -0.047399208, -0.026946466, 0.056859523, 0.031121913, -0.026946466, -0.089002594, 0.07599285, -0.015725713, -0.27966428, -0.036178455, 0.029121067, 0.02319397, 0.053551342, 0.029121067, -0.27966428, -0.013724867, -0.049387977, -0.089002594, -0.036178455, -0.049387977, 0.056859523, -0.036178455, 0.017900314, -0.089002594, 0.053551342, 0.051562577, -0.089002594, -0.013724867, 0.06278333, -0.27966428, 0.053551342, -0.038155142, -0.27966428, 0.031121913, 0.051562577, -0.089002594, 0.0647721, -0.038155142, 0.056859523, -0.013724867, -0.026946466, -0.27966428, 0.0647721, 0.017900314, 0.034393862, 0.053551342, -0.026946466, 0.056859523, 0.0647721, 0.0066916384, -0.089002594, 0.0647721, 0.040329743)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_3cvvy"]
points = PackedVector3Array(-0.27967966, 0.06477541, 0.017897021, -0.4367087, -0.036221273, -0.026948664, -0.4367087, -0.036221273, 0.029113382, -0.38060492, -0.17079127, -0.026948664, -0.27967966, 0.031086784, -0.04939127, -0.27967966, -0.013785254, 0.05156587, -0.4367087, 0.06477541, 0.017897021, -0.4367087, 0.031086784, -0.04939127, -0.41959414, -0.16049999, 0.016428277, -0.4367087, 0.031086784, 0.05156587, -0.2909004, -0.08104719, -0.026948664, -0.38060492, -0.17079127, 0.017897021, -0.42547256, -0.17079127, -0.026948664, -0.4367087, 0.05354586, -0.038165025, -0.27967966, -0.013785254, -0.04939127, -0.4367087, -0.013785254, 0.05156587, -0.27967966, 0.05354586, 0.040339626, -0.27967966, 0.06477541, -0.015732301, -0.2909004, -0.08104719, 0.017897021, -0.4367087, -0.013785254, -0.04939127, -0.3245473, -0.12591924, -0.026948664, -0.27967966, 0.031086784, 0.05156587, -0.4367087, 0.05354586, 0.040339626, -0.27967966, 0.05354586, -0.038165025, -0.4367087, 0.06477541, -0.015732301, -0.27967966, -0.036221273, -0.026948664, -0.27967966, -0.036221273, 0.029113382)
[node name="SimpleKey" type="Node3D" unique_id=650555678 node_paths=PackedStringArray("body", "snapAnchor", "visualMeshNode")]
script = ExtResource("1_rsor3")
body = NodePath("RigidBody3D")
snapAnchor = NodePath("RigidBody3D/SnapAnchor")
visualMeshNode = NodePath("RigidBody3D/MeshInstance3D")
metadata/_custom_type_script = "uid://b143brnl7gf4f"
[node name="RigidBody3D" type="RigidBody3D" parent="." unique_id=1946674219]
collision_layer = 9
collision_mask = 13
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D" unique_id=1252834786]
shape = SubResource("BoxShape3D_1blfk")
[node name="MeshInstance3D" type="MeshInstance3D" parent="RigidBody3D" unique_id=2082673006]
mesh = SubResource("BoxMesh_va8t4")
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
mesh = ExtResource("2_w4i4f")
surface_material_override/0 = SubResource("StandardMaterial3D_w4i4f")
[node name="CollisionShape3D8" type="CollisionShape3D" parent="RigidBody3D" unique_id=668361815]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_w4i4f")
[node name="CollisionShape3D7" type="CollisionShape3D" parent="RigidBody3D" unique_id=254679764]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_ycjx8")
[node name="CollisionShape3D6" type="CollisionShape3D" parent="RigidBody3D" unique_id=1906243872]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_qtgaf")
[node name="CollisionShape3D5" type="CollisionShape3D" parent="RigidBody3D" unique_id=1650561327]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_kcr48")
[node name="CollisionShape3D4" type="CollisionShape3D" parent="RigidBody3D" unique_id=957277933]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_4nhs8")
[node name="CollisionShape3D3" type="CollisionShape3D" parent="RigidBody3D" unique_id=790605504]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_k8bjv")
[node name="CollisionShape3D2" type="CollisionShape3D" parent="RigidBody3D" unique_id=218214800]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_thc0q")
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D" unique_id=1906805590]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, -0.06127593)
shape = SubResource("ConvexPolygonShape3D_3cvvy")
[node name="SnapAnchor" type="Marker3D" parent="RigidBody3D" unique_id=389082687]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.15)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00036647916, 0, -0.27831292)
+19 -12
View File
@@ -1,26 +1,33 @@
[gd_scene format=3 uid="uid://cvipcpeglasek"]
[ext_resource type="Script" uid="uid://xd03vepkva1l" path="res://Scripts/Socket.gd" id="1_5ldhx"]
[ext_resource type="Material" uid="uid://cgv3rv0ll5vul" path="res://Materials/HologramMaterial.tres" id="2_phqk8"]
[ext_resource type="ArrayMesh" uid="uid://c1turkdbdf672" path="res://Meshes/LockMesh.tres" id="2_xuv5d"]
[sub_resource type="BoxMesh" id="BoxMesh_1blfk"]
size = Vector3(1, 1, 0.2)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_phqk8"]
albedo_color = Color(1, 0.6627451, 0.27450982, 1)
[sub_resource type="BoxShape3D" id="BoxShape3D_1blfk"]
size = Vector3(1, 1, 0.2)
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_xuv5d"]
points = PackedVector3Array(-0.27519998, -0.8941344, -0.2593403, 0.26456764, 0.027564, 0.9763753, -0.24300638, 0.02218617, 0.99558824, 0.15747233, 1.5342898, -0.27855548, 0.26650333, -0.4031767, -0.8864768, -0.2739767, 0.41260198, -0.8711741, -0.1721238, 1.410366, 0.42174292, 0.2675441, -0.9146684, 0.322574, -0.2431448, -0.68814415, 0.71976835, 0.26387632, 0.33631924, -0.91568136, 0.15747233, 1.3693162, 0.50403607, -0.2442107, -0.29608637, -0.9411231, -0.1721238, 1.2867005, -0.48449, -0.27519998, 0.37477624, 0.89426947, 0.28552645, 0.5883212, -0.46201938, 0.26729187, -0.8742861, -0.4199976, 0.32236114, -0.23756212, -0.6906262, 0.2668279, -0.36496803, 0.9069698, -0.27025545, 0.94044054, -0.17905393, 0.25967497, 0.904319, 0.3887875, -0.24515258, -0.97439086, 0.12878603, -0.27519998, -0.701846, -0.6439396, -0.1721238, 1.5342898, 0.21560669, 0.15747233, 1.2867005, -0.52583826, 0.26116356, 0.41213495, 0.886924, -0.27519998, -0.3555823, 0.89426947, 0.15747233, 1.5755978, 0.21560669, -0.1721238, 1.5342898, -0.1549141, -0.24200568, 0.33703282, -0.9329809, 0.3042074, -0.74898386, 0.12586175, 0.26596537, -0.0906211, -0.9624079, 0.26534107, -0.7102548, 0.6689699)
[node name="SimpleSocket" type="Node3D" unique_id=1835661048 node_paths=PackedStringArray("snapPoint", "snapArea")]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, 0, 0)
script = ExtResource("1_5ldhx")
snapPoint = NodePath("Marker3D")
snapArea = NodePath("Area3D")
metadata/_custom_type_script = "uid://xd03vepkva1l"
snapDistance = 2.0
hologramMaterial = ExtResource("2_phqk8")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=1351826322]
mesh = SubResource("BoxMesh_1blfk")
[node name="Area3D" type="Area3D" parent="." unique_id=182097832]
[node name="Area3D" type="Area3D" parent="." unique_id=792436256]
[node name="MeshInstance3D" type="MeshInstance3D" parent="Area3D" unique_id=1460440288]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, 0)
mesh = ExtResource("2_xuv5d")
surface_material_override/0 = SubResource("StandardMaterial3D_phqk8")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" unique_id=1932740275]
shape = SubResource("BoxShape3D_1blfk")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" unique_id=893677199]
transform = Transform3D(-2.1855694e-08, 0, -0.5, 0, 0.5, 0, 0.5, 0, -2.1855694e-08, 0, 0, 0)
shape = SubResource("ConvexPolygonShape3D_xuv5d")
[node name="Marker3D" type="Marker3D" parent="." unique_id=1726119799]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.1)
[node name="Marker3D" type="Marker3D" parent="." unique_id=1828909901]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0037084222, -0.27249002, 0.154115)