interaction
This commit is contained in:
parent
5e20eeb8bf
commit
d98eb6335f
13 changed files with 145 additions and 24 deletions
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource type="Script" uid="uid://b3i73cilpra74" path="res://src/resources/draggable.gd" id="1_62sy8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bdyc1cwthn845" path="res://icon.svg" id="1_kgkdo"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjxjcx2qu16q5" path="res://scenes/draggable_object.tscn" id="2_jkgu4"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjxjcx2qu16q5" path="res://scenes/flask.tscn" id="2_jkgu4"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_62sy8")
|
||||
|
|
|
|||
BIN
assets/meshes/jar.res
Normal file
BIN
assets/meshes/jar.res
Normal file
Binary file not shown.
BIN
assets/meshes/jar_fill.res
Normal file
BIN
assets/meshes/jar_fill.res
Normal file
Binary file not shown.
|
|
@ -48,6 +48,26 @@ _subresources={
|
|||
"use_external/fallback_path": "res://assets/materials/mat_glass.tres",
|
||||
"use_external/path": "uid://64m17act0kwu"
|
||||
}
|
||||
},
|
||||
"meshes": {
|
||||
"Chemistry_Circle_001": {
|
||||
"generate/lightmap_uv": 0,
|
||||
"generate/lods": 0,
|
||||
"generate/shadow_meshes": 0,
|
||||
"lods/normal_merge_angle": 20.0,
|
||||
"save_to_file/enabled": true,
|
||||
"save_to_file/fallback_path": "res://assets/meshes/jar_fill.res",
|
||||
"save_to_file/path": "uid://dxeseuqcwne1m"
|
||||
},
|
||||
"Chemistry_Circle_003": {
|
||||
"generate/lightmap_uv": 0,
|
||||
"generate/lods": 0,
|
||||
"generate/shadow_meshes": 0,
|
||||
"lods/normal_merge_angle": 20.0,
|
||||
"save_to_file/enabled": true,
|
||||
"save_to_file/fallback_path": "res://assets/meshes/jar.res",
|
||||
"save_to_file/path": "uid://dddqboph2ygmw"
|
||||
}
|
||||
}
|
||||
}
|
||||
gltf/naming_version=2
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ drag_camera={
|
|||
|
||||
3d_physics/layer_1="Drag"
|
||||
3d_physics/layer_2="Interaction"
|
||||
3d_physics/layer_3="FlaskInteraction"
|
||||
|
||||
[rendering]
|
||||
|
||||
|
|
|
|||
|
|
@ -1,15 +1,20 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://bjxjcx2qu16q5"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bjxjcx2qu16q5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_vcwhe"]
|
||||
[ext_resource type="Script" uid="uid://ctu7escah5lo1" path="res://src/interactible/interaction_source.gd" id="2_627mb"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6ydpkle2ol20" path="res://assets/models/FlaskNew.glb" id="2_qf1og"]
|
||||
[ext_resource type="Script" uid="uid://e8xu57ewvb5a" path="res://src/interactible/proximity_rotator.gd" id="3_00eeh"]
|
||||
[ext_resource type="Script" uid="uid://dteb2xxl8gixp" path="res://src/ui/slider_display.gd" id="5_qb0nw"]
|
||||
[ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_0xufn"]
|
||||
[ext_resource type="PackedScene" uid="uid://b6ydpkle2ol20" path="res://assets/models/FlaskNew.glb" id="2_h7awq"]
|
||||
[ext_resource type="Script" uid="uid://mjx50qh1bwv3" path="res://src/interactible/interaction_reciever.gd" id="3_ailwx"]
|
||||
[ext_resource type="Script" uid="uid://ctu7escah5lo1" path="res://src/interactible/interaction_source.gd" id="4_kkw7a"]
|
||||
[ext_resource type="Script" uid="uid://e8xu57ewvb5a" path="res://src/interactible/proximity_rotator.gd" id="5_rqua0"]
|
||||
[ext_resource type="Script" uid="uid://dteb2xxl8gixp" path="res://src/ui/slider_display.gd" id="6_wadb5"]
|
||||
|
||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_vcwhe"]
|
||||
radius = 0.1
|
||||
height = 0.9921875
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_0xufn"]
|
||||
height = 0.16210938
|
||||
radius = 0.625
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_vcwhe"]
|
||||
radius = 0.49649125
|
||||
|
||||
|
|
@ -18,26 +23,36 @@ _data = [Vector2(0, 0), 0.0, 0.067761436, 0, 0, Vector2(0.75, 1), 0.0, 0.0, 0, 0
|
|||
point_count = 2
|
||||
|
||||
[node name="Flask" type="Area3D"]
|
||||
script = ExtResource("1_vcwhe")
|
||||
script = ExtResource("1_0xufn")
|
||||
|
||||
[node name="DragArea" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("CapsuleShape3D_vcwhe")
|
||||
|
||||
[node name="FlaskNew" parent="." instance=ExtResource("2_qf1og")]
|
||||
[node name="FlaskNew" parent="." instance=ExtResource("2_h7awq")]
|
||||
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, -0.38859487, 0)
|
||||
|
||||
[node name="InteractibleArea" type="Area3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.6011598, 0)
|
||||
collision_layer = 6
|
||||
collision_mask = 0
|
||||
script = ExtResource("3_ailwx")
|
||||
metadata/_custom_type_script = "uid://mjx50qh1bwv3"
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="InteractibleArea"]
|
||||
shape = SubResource("CylinderShape3D_0xufn")
|
||||
|
||||
[node name="InteractionArea" type="Area3D" parent="." node_paths=PackedStringArray("interaction_dialog")]
|
||||
collision_layer = 2
|
||||
collision_mask = 2
|
||||
input_ray_pickable = false
|
||||
script = ExtResource("2_627mb")
|
||||
script = ExtResource("4_kkw7a")
|
||||
interaction_dialog = NodePath("../InteractionDialog")
|
||||
|
||||
[node name="InteractionArea" type="CollisionShape3D" parent="InteractionArea"]
|
||||
shape = SubResource("SphereShape3D_vcwhe")
|
||||
|
||||
[node name="ProximityRotator" type="Node" parent="." node_paths=PackedStringArray("rotated")]
|
||||
script = ExtResource("3_00eeh")
|
||||
script = ExtResource("5_rqua0")
|
||||
rotated = NodePath("..")
|
||||
proximity_radius = 0.1
|
||||
modification_curve = SubResource("Curve_qb0nw")
|
||||
|
|
@ -56,14 +71,14 @@ offset_bottom = 82.0
|
|||
|
||||
[node name="Label" type="Label" parent="InteractionDialog/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Введите объём"
|
||||
text = "Введите количество"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="InteractionDialog/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="AmountLabel" type="Label" parent="InteractionDialog/VBoxContainer/HBoxContainer" node_paths=PackedStringArray("slider")]
|
||||
layout_mode = 2
|
||||
script = ExtResource("5_qb0nw")
|
||||
script = ExtResource("6_wadb5")
|
||||
slider = NodePath("../HSlider")
|
||||
suffix = "%"
|
||||
|
||||
|
|
@ -1,9 +1,8 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://c7r4rhgj3ucao"]
|
||||
[gd_scene load_steps=9 format=3 uid="uid://c7r4rhgj3ucao"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://bjxjcx2qu16q5" path="res://scenes/draggable_object.tscn" id="1_bb6uc"]
|
||||
[ext_resource type="PackedScene" uid="uid://bjxjcx2qu16q5" path="res://scenes/flask.tscn" id="1_bb6uc"]
|
||||
[ext_resource type="Script" uid="uid://crjao0jjv5yqs" path="res://src/drag/draggable_camera.gd" id="1_hem3r"]
|
||||
[ext_resource type="PackedScene" uid="uid://dfxlr4svnsdyx" path="res://scenes/ui.tscn" id="3_hflkp"]
|
||||
[ext_resource type="PackedScene" uid="uid://q1y0r2rn0qb4" path="res://scenes/interactible_object.tscn" id="4_f680m"]
|
||||
[ext_resource type="PackedScene" uid="uid://bx5wihgk668w1" path="res://assets/models/Chemistry.glb" id="5_q4uld"]
|
||||
[ext_resource type="PackedScene" uid="uid://bg8y4u2a4hx3p" path="res://assets/models/Drip.glb" id="6_gipex"]
|
||||
[ext_resource type="PackedScene" uid="uid://dwtaqdacgcysa" path="res://assets/models/FlaskHolder.glb" id="7_064jp"]
|
||||
|
|
@ -32,9 +31,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.542716, 1.0920403, 0.20219
|
|||
transform = Transform3D(1, 0, 0, 0, 0.8403207, 0.5420896, 0, -0.5420896, 0.8403207, 0, 1.9293891, 0)
|
||||
shadow_enabled = true
|
||||
|
||||
[node name="InteractibleObject" parent="." instance=ExtResource("4_f680m")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.11957906, 0.87858754, -0.0035084486)
|
||||
|
||||
[node name="UI" type="CanvasLayer" parent="."]
|
||||
layer = 100
|
||||
|
||||
|
|
|
|||
85
scenes/substance_jar.tscn
Normal file
85
scenes/substance_jar.tscn
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
[gd_scene load_steps=10 format=3 uid="uid://cw6v8kbi76qak"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bjnv2g1ni0525" path="res://src/drag/draggable_object.gd" id="1_o7vug"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://dddqboph2ygmw" path="res://assets/meshes/jar.res" id="2_o7vug"]
|
||||
[ext_resource type="Script" uid="uid://ctu7escah5lo1" path="res://src/interactible/interaction_source.gd" id="3_00jpx"]
|
||||
[ext_resource type="Script" uid="uid://e8xu57ewvb5a" path="res://src/interactible/proximity_rotator.gd" id="4_ymvgp"]
|
||||
[ext_resource type="ArrayMesh" uid="uid://dxeseuqcwne1m" path="res://assets/meshes/jar_fill.res" id="6_kfk5m"]
|
||||
[ext_resource type="Script" uid="uid://co33kqhl3n06u" path="res://src/interactible/destructor.gd" id="7_00jpx"]
|
||||
|
||||
[sub_resource type="CylinderShape3D" id="CylinderShape3D_kfk5m"]
|
||||
height = 0.5024414
|
||||
radius = 0.22460938
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_vcwhe"]
|
||||
radius = 0.49649125
|
||||
|
||||
[sub_resource type="Curve" id="Curve_qb0nw"]
|
||||
_data = [Vector2(0, 0), 0.0, 0.067761436, 0, 0, Vector2(0.75, 1), 0.0, 0.0, 0, 0]
|
||||
point_count = 2
|
||||
|
||||
[node name="Flask" type="Area3D"]
|
||||
script = ExtResource("1_o7vug")
|
||||
|
||||
[node name="Jar" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.20877336, 0)
|
||||
mesh = ExtResource("2_o7vug")
|
||||
|
||||
[node name="DragArea" type="CollisionShape3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.04284668, 0)
|
||||
shape = SubResource("CylinderShape3D_kfk5m")
|
||||
|
||||
[node name="InteractionArea" type="Area3D" parent="." node_paths=PackedStringArray("interaction_dialog")]
|
||||
collision_layer = 4
|
||||
collision_mask = 4
|
||||
input_ray_pickable = false
|
||||
script = ExtResource("3_00jpx")
|
||||
interaction_dialog = NodePath("../InteractionDialog")
|
||||
|
||||
[node name="InteractionArea" type="CollisionShape3D" parent="InteractionArea"]
|
||||
shape = SubResource("SphereShape3D_vcwhe")
|
||||
|
||||
[node name="ProximityRotator" type="Node" parent="." node_paths=PackedStringArray("rotated")]
|
||||
script = ExtResource("4_ymvgp")
|
||||
rotated = NodePath("..")
|
||||
proximity_radius = 0.1
|
||||
modification_curve = SubResource("Curve_qb0nw")
|
||||
|
||||
[node name="InteractionDialog" type="ConfirmationDialog" parent="."]
|
||||
oversampling_override = 1.0
|
||||
position = Vector2i(0, 36)
|
||||
size = Vector2i(200, 131)
|
||||
borderless = true
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="InteractionDialog"]
|
||||
offset_left = 8.0
|
||||
offset_top = 8.0
|
||||
offset_right = 192.0
|
||||
offset_bottom = 82.0
|
||||
|
||||
[node name="Label" type="Label" parent="InteractionDialog/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Введите объём"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="InteractionDialog/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="SpinBox" type="SpinBox" parent="InteractionDialog/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
max_value = 10.0
|
||||
step = 0.01
|
||||
allow_greater = true
|
||||
suffix = "мг"
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, -0.20759426, 0)
|
||||
mesh = ExtResource("6_kfk5m")
|
||||
|
||||
[node name="DestructorOnStop" type="Node" parent="." node_paths=PackedStringArray("node")]
|
||||
script = ExtResource("7_00jpx")
|
||||
node = NodePath("..")
|
||||
|
||||
[connection signal="drag_ended" from="." to="InteractionArea" method="request_interaction"]
|
||||
[connection signal="interaction_closed" from="InteractionArea" to="DestructorOnStop" method="destruct"]
|
||||
[connection signal="interaction_reciever_entered" from="InteractionArea" to="ProximityRotator" method="_on_interaction_area_interaction_reciever_entered"]
|
||||
[connection signal="interaction_reciever_exited" from="InteractionArea" to="ProximityRotator" method="_on_interaction_area_interaction_reciever_exited"]
|
||||
6
src/interactible/destructor.gd
Normal file
6
src/interactible/destructor.gd
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
extends Node
|
||||
|
||||
@export var node: Node3D
|
||||
|
||||
func destruct() -> void:
|
||||
node.queue_free()
|
||||
1
src/interactible/destructor.gd.uid
Normal file
1
src/interactible/destructor.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://co33kqhl3n06u
|
||||
|
|
@ -7,8 +7,6 @@ var start_rotation
|
|||
var reciever: InteractionReciever
|
||||
|
||||
func _ready() -> void:
|
||||
print(self.get_path(), rotated)
|
||||
print_stack()
|
||||
start_rotation = rotated.quaternion
|
||||
|
||||
func _on_interaction_area_interaction_reciever_entered(rec: InteractionReciever) -> void:
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@ extends Resource
|
|||
class_name Reagent
|
||||
|
||||
@export var substance: Substance
|
||||
@export var storage: PackedScene
|
||||
@export var storage: PackedScene = preload("res://scenes/substance_jar.tscn")
|
||||
|
|
|
|||
|
|
@ -7,8 +7,7 @@ func _ready() -> void:
|
|||
text = reagent.substance.get_formula()
|
||||
|
||||
func _on_button_down() -> void:
|
||||
return
|
||||
var scene = reagent.scene.instantiate()
|
||||
var scene = reagent.storage.instantiate()
|
||||
if scene is DraggableObject:
|
||||
scene.dragged = true
|
||||
scene.mouse_in = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue