diff --git a/Counter.tscn b/Counter.tscn index 6b08195..1c2a4c7 100644 --- a/Counter.tscn +++ b/Counter.tscn @@ -8,7 +8,7 @@ [sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"] -[node name="Counter" type="StaticBody3D" unique_id=1487893288] +[node name="Counter" type="StaticBody3D" unique_id=1487893288 groups=["station"]] [node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=692568688] shape = SubResource("BoxShape3D_24d3s") @@ -20,7 +20,7 @@ mesh = SubResource("BoxMesh_i5j2u") transform = Transform3D(0.9999992, 0, 0, 0, 0.99999946, 0, 0, 0, 0.9999992, 0.002797456, 0.6309581, -0.2812457) text = "Counter" -[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1647380272] +[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1647380272 groups=["station"]] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5270121, 0) collision_layer = 65536 collision_mask = 65536 diff --git a/Hob.tscn b/Hob.tscn index d5bf98f..ab673b1 100644 --- a/Hob.tscn +++ b/Hob.tscn @@ -15,7 +15,7 @@ material = SubResource("StandardMaterial3D_m5xe2") [sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"] -[node name="Hob" type="StaticBody3D" unique_id=1687971542] +[node name="Hob" type="StaticBody3D" unique_id=1687971542 groups=["station"]] script = ExtResource("1_7jc4g") [node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1283846023] diff --git a/JonScene.tscn b/JonScene.tscn index 30bac9d..184665d 100644 --- a/JonScene.tscn +++ b/JonScene.tscn @@ -11,6 +11,7 @@ [ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://BurgerBunsDispenser.tscn" id="9_wlcqk"] [ext_resource type="PackedScene" uid="uid://bp3v1jl8pctro" path="res://plate.tscn" id="10_rbb5l"] [ext_resource type="PackedScene" uid="uid://dpot5qie20vf6" path="res://burger.tscn" id="11_65p64"] +[ext_resource type="PackedScene" uid="uid://b3m2ag8g5rj4r" path="res://hamburger.tscn" id="12_65p64"] [sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"] size = Vector3(5, 0.1, 5) @@ -71,10 +72,10 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.832131, 0.40028095, -1.481 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.1282921, 1.4976386, -1.0923254) [node name="Plate" parent="." unique_id=190487773 instance=ExtResource("10_rbb5l")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.6570369, 1.4458435, -1.135189) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.53572595, 1.4458435, -1.135189) [node name="burger" parent="." unique_id=1417604760 instance=ExtResource("11_65p64")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.04444152, 1.4235804, -1.1413177) +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.91607785, 1.4235804, -1.0899508) [node name="burger2" parent="." unique_id=1584460510 instance=ExtResource("11_65p64")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.23121053, 1.4235804, -1.3225337) @@ -84,3 +85,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.22395861, 1.4235804, -1.14 [node name="burger4" parent="." unique_id=1844818864 instance=ExtResource("11_65p64")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.40808713, 1.4235804, -1.1413177) + +[node name="Hamburger" parent="." unique_id=761091445 instance=ExtResource("12_65p64")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.5295425, 1.994761, -1.1201752) diff --git a/Prefabs/container.gd b/Prefabs/container.gd new file mode 100644 index 0000000..853dba1 --- /dev/null +++ b/Prefabs/container.gd @@ -0,0 +1,59 @@ +extends Node3D + +@export var target_group : String # Items with this tag can be added to the container +@export var meal_positions: Array[Node3D] = [] +@export var side_positions: Array[Node3D] = [] + +@onready var area_3d: Area3D = $Area3D +@onready var xr_pickable: XRToolsPickable = get_parent() as XRToolsPickable + +@onready var _meal_container: Node3D = $MealContainer +@onready var _sides_container: Node3D = $SidesContainer + +var contained_items: Array[FoodItem] + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + area_3d.body_entered.connect(_on_body_entered) + if not area_3d: + push_error("Area3D node not found in container.gd") + if not xr_pickable: + push_error("XRPickable node not found in container.gd") + + +func _on_body_entered (body) -> void: + if not body.is_in_group(target_group): + return + print("Body is platable: %s" % body.name) + var picked_by = xr_pickable.get_picked_up_by() + if picked_by and picked_by.is_in_group("station"): + print("Container in station") + var food_item = get_node("FoodItem") + if food_item.type == FoodItem.Type.MEAL or food_item.type == FoodItem.Type.SIDE: + # if we're full of that type: + # return + # body disble pickable + # container parent to self + # body set position to apropriate slot + pass + + +#plate (Pickalbe) + #XRGrapPoints + #container (script) (meal positions[1], side positions[4]) + #area + #meals + #meal - burger + #sides + #side - chips + #side - onion rings + +#tray (Pickalbe) + #XRGrapPoints + #container (script) (meal positions[4], side positions[0]) + #food items + #meals + #meal - cookie + #meal - cookie + #meal - cookie + #meal - cookie diff --git a/Prefabs/container.gd.uid b/Prefabs/container.gd.uid new file mode 100644 index 0000000..66c3ef7 --- /dev/null +++ b/Prefabs/container.gd.uid @@ -0,0 +1 @@ +uid://6lyhyial1fh5 diff --git a/Prefabs/container.tscn b/Prefabs/container.tscn index 458b618..2e3da29 100644 --- a/Prefabs/container.tscn +++ b/Prefabs/container.tscn @@ -1,51 +1,21 @@ [gd_scene format=3 uid="uid://du31pqeytu8as"] -[ext_resource type="PackedScene" uid="uid://c8l60rnugru40" path="res://addons/godot-xr-tools/objects/pickable.tscn" id="1_gc2lj"] -[ext_resource type="PackedScene" uid="uid://c25yxb0vt53vc" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_left.tscn" id="2_2yi8i"] -[ext_resource type="Animation" uid="uid://db62hs5s4n2b3" path="res://addons/godot-xr-tools/hands/animations/left/Grip 4.res" id="3_ruxut"] -[ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="4_wcdop"] -[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_faibp"] -[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_uv6q4"] -[ext_resource type="Script" uid="uid://dounic663dn5q" path="res://combinable_item.gd" id="7_tl02b"] -[ext_resource type="Script" uid="uid://coidnv8b2yvxr" path="res://combine_recipe.gd" id="8_78en8"] -[ext_resource type="PackedScene" uid="uid://cucc3gaqu2nab" path="res://Charcoal.tscn" id="9_tbb42"] -[ext_resource type="Script" uid="uid://e3im02nq5cye" path="res://combine_zone.gd" id="10_gdify"] +[ext_resource type="Script" uid="uid://6lyhyial1fh5" path="res://Prefabs/container.gd" id="1_r4cle"] -[sub_resource type="Resource" id="Resource_2hcq0"] -script = ExtResource("4_wcdop") -closed_pose = ExtResource("3_ruxut") -metadata/_custom_type_script = "uid://dvobm6vcfnqe8" +[sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"] +radius = 0.2 -[sub_resource type="Resource" id="Resource_dlngj"] -script = ExtResource("4_wcdop") -closed_pose = ExtResource("6_uv6q4") -metadata/_custom_type_script = "uid://dvobm6vcfnqe8" +[node name="Container" type="Node3D" unique_id=377793422 node_paths=PackedStringArray("meal_positions")] +script = ExtResource("1_r4cle") +meal_positions = [null] -[sub_resource type="Resource" id="Resource_recipe_cube"] -script = ExtResource("8_78en8") -ingredient_id = &"cube" -result = ExtResource("9_tbb42") +[node name="Area3D" type="Area3D" parent="." unique_id=126983781] +collision_layer = 2 +collision_mask = 65540 -[sub_resource type="BoxShape3D" id="BoxShape3D_u2x4d"] -size = Vector3(0.16, 0.16, 0.16) +[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" unique_id=286964882] +shape = SubResource("SphereShape3D_vlqg6") -[node name="Container" unique_id=190487773 instance=ExtResource("1_gc2lj")] +[node name="MealContainer" type="Node3D" parent="." unique_id=258551044] -[node name="GrabPointHandLeft" parent="." index="1" unique_id=317886291 instance=ExtResource("2_2yi8i")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.067650706, 0.04601878, -0.08606844) -hand_pose = SubResource("Resource_2hcq0") - -[node name="GrabPointHandRight" parent="." index="2" unique_id=248026585 instance=ExtResource("5_faibp")] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06531982, 0.042291984, -0.08604182) -hand_pose = SubResource("Resource_dlngj") - -[node name="CombinableItem" type="Node" parent="." index="3" unique_id=158282297] -script = ExtResource("7_tl02b") -id = &"None" -recipes = Array[ExtResource("8_78en8")]([SubResource("Resource_recipe_cube")]) - -[node name="CombineZone" type="Area3D" parent="." index="4" unique_id=1782955181] -script = ExtResource("10_gdify") - -[node name="CollisionShape3D" type="CollisionShape3D" parent="CombineZone" index="0" unique_id=819250076] -shape = SubResource("BoxShape3D_u2x4d") +[node name="SidesContainer" type="Node3D" parent="." unique_id=1464979199] diff --git a/food_item.gd b/food_item.gd new file mode 100644 index 0000000..69fe647 --- /dev/null +++ b/food_item.gd @@ -0,0 +1,8 @@ +class_name FoodItem +extends Node + +# Define the Enum at the top of your script +enum Type { MEAL, SIDE, INGREDIENT } + +@export var id: String +@export var type: ItemType = Type.INGREDIENT diff --git a/food_item.gd.uid b/food_item.gd.uid new file mode 100644 index 0000000..4f0306c --- /dev/null +++ b/food_item.gd.uid @@ -0,0 +1 @@ +uid://5tpoohkopryv diff --git a/food_item.tscn b/food_item.tscn new file mode 100644 index 0000000..ceca1a4 --- /dev/null +++ b/food_item.tscn @@ -0,0 +1,8 @@ +[gd_scene format=3 uid="uid://bfj80jh13t6e5"] + +[ext_resource type="Script" uid="uid://5tpoohkopryv" path="res://food_item.gd" id="1_0na5k"] + +[node name="FoodItem" type="Node" unique_id=63948206] +script = ExtResource("1_0na5k") +id = "hamburger" +item_type = "Meal" diff --git a/hamburger.tscn b/hamburger.tscn index 9837fbc..39eb897 100644 --- a/hamburger.tscn +++ b/hamburger.tscn @@ -6,6 +6,7 @@ [ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="4_cljtj"] [ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_dunns"] [ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_fh0f6"] +[ext_resource type="PackedScene" uid="uid://bfj80jh13t6e5" path="res://food_item.tscn" id="7_yy3y8"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_fco8w"] height = 0.10392761 @@ -27,7 +28,8 @@ albedo_color = Color(0.6784191, 0.54546416, 0.016760282, 1) [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6l01i"] albedo_color = Color(0.29, 0.101500005, 0, 1) -[node name="Hamburger" unique_id=1675596942 instance=ExtResource("1_3gf3l")] +[node name="Hamburger" unique_id=1675596942 groups=["platalbe_item"] instance=ExtResource("1_3gf3l")] +gravity_scale = 0.04 [node name="CollisionShape3D" parent="." index="0"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.02, 0.02, 0) @@ -74,3 +76,6 @@ radius = 0.08300781 height = 0.03 sides = 16 material = SubResource("StandardMaterial3D_6l01i") + +[node name="FoodItem" parent="." index="5" unique_id=63948206 instance=ExtResource("7_yy3y8")] +item_type = null diff --git a/hob.gd b/hob.gd index 05df105..c1467d4 100644 --- a/hob.gd +++ b/hob.gd @@ -16,7 +16,7 @@ func _ready() -> void: print("Hob is empty") func convert_item(cookable: CookableItem) -> void: - print("Converting ", cookable) + print("Hob converting ", cookable) var old_pickable = snap_zone.picked_up_object if not old_pickable: @@ -39,9 +39,7 @@ func convert_item(cookable: CookableItem) -> void: # Called every frame. 'delta' is the elapsed time since the previous frame. -func _process(delta: float) -> void: - #print("Picked obj:", snap_zone.picked_up_object) - +func _process(delta: float) -> void: # Find the CookableItem in held object var cookable = null if snap_zone.picked_up_object: diff --git a/plate.tscn b/plate.tscn index 68daaaa..768c808 100644 --- a/plate.tscn +++ b/plate.tscn @@ -1,43 +1,85 @@ [gd_scene format=3 uid="uid://bp3v1jl8pctro"] +[ext_resource type="Script" uid="uid://bfrlpbsqg5lqr" path="res://addons/godot-xr-tools/objects/pickable.gd" id="1_nq5sa"] [ext_resource type="PackedScene" uid="uid://du31pqeytu8as" path="res://Prefabs/container.tscn" id="1_s5yhh"] +[ext_resource type="PackedScene" uid="uid://c25yxb0vt53vc" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_left.tscn" id="2_3bkoa"] +[ext_resource type="Animation" uid="uid://db62hs5s4n2b3" path="res://addons/godot-xr-tools/hands/animations/left/Grip 4.res" id="3_6v47p"] +[ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="4_dhtvl"] +[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_vlcpl"] +[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_el51w"] [sub_resource type="CylinderShape3D" id="CylinderShape3D_kek77"] height = 0.0635376 radius = 0.20996094 -[node name="Plate" unique_id=190487773 instance=ExtResource("1_s5yhh")] +[sub_resource type="Resource" id="Resource_2hcq0"] +script = ExtResource("4_dhtvl") +closed_pose = ExtResource("3_6v47p") +metadata/_custom_type_script = "uid://dvobm6vcfnqe8" -[node name="CollisionShape3D" parent="." index="0"] +[sub_resource type="Resource" id="Resource_dlngj"] +script = ExtResource("4_dhtvl") +closed_pose = ExtResource("6_el51w") +metadata/_custom_type_script = "uid://dvobm6vcfnqe8" + +[node name="Plate" type="RigidBody3D" unique_id=190487773] +collision_layer = 4 +collision_mask = 196615 +freeze_mode = 1 +script = ExtResource("1_nq5sa") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1365637864] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.007171631, 0) shape = SubResource("CylinderShape3D_kek77") -[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." index="1" unique_id=1767596918] +[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=1767596918] autosmooth = true smoothing_angle = 103.9 -[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" index="0" unique_id=410722205] +[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=410722205] radius = 0.2 height = 0.03 sides = 16 -[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCylinder3D" index="0" unique_id=1041060379] +[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCylinder3D" unique_id=1041060379] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.010312311, 0) operation = 2 radius = 0.15 height = 0.03 sides = 16 -[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D" index="1" unique_id=1827566539] +[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=1827566539] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.027119078, 0) radius = 0.15 height = 0.02 -[node name="GrabPointHandLeft" parent="." index="2" unique_id=317886291] +[node name="GrabPointHandLeft" parent="." unique_id=317886291 instance=ExtResource("2_3bkoa")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.1699356, 0.04601878, -0.08606844) +hand_pose = SubResource("Resource_2hcq0") -[node name="GrabPointHandRight" parent="." index="3" unique_id=248026585] +[node name="GrabPointHandRight" parent="." unique_id=248026585 instance=ExtResource("5_vlcpl")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.16517048, 0.042291984, -0.08604182) +hand_pose = SubResource("Resource_dlngj") -[node name="CombinableItem" parent="." index="4" unique_id=158282297] -id = &"plate" +[node name="Container" parent="." unique_id=377793422 node_paths=PackedStringArray("meal_positions", "side_positions") instance=ExtResource("1_s5yhh")] +target_group = "platalbe_item" +meal_positions = [NodePath("MealPositions/Slot1")] +side_positions = [NodePath("SidePositions/Slot1"), NodePath("SidePositions/Slot2"), NodePath("SidePositions/Slot3"), NodePath("SidePositions/Slot4")] + +[node name="MealPositions" type="Node3D" parent="Container" unique_id=1682052877] + +[node name="Slot1" type="Node3D" parent="Container/MealPositions" unique_id=306927548] + +[node name="SidePositions" type="Node3D" parent="Container" unique_id=1112098031] + +[node name="Slot1" type="Node3D" parent="Container/SidePositions" unique_id=1314895915] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.05862564, 0, -0.098608926) + +[node name="Slot2" type="Node3D" parent="Container/SidePositions" unique_id=46117678] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.090641126, 0, -0.08815916) + +[node name="Slot3" type="Node3D" parent="Container/SidePositions" unique_id=1994697744] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.08457637, 0, 0.08950478) + +[node name="Slot4" type="Node3D" parent="Container/SidePositions" unique_id=379534402] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06938871, 0, 0.072598234) diff --git a/project.godot b/project.godot index 2262e43..7444585 100644 --- a/project.godot +++ b/project.godot @@ -33,6 +33,11 @@ enabled=PackedStringArray("res://addons/godot-xr-tools/plugin.cfg") import/blender/enabled=false +[global_group] + +platalbe_item="Meals, sides, augments for meals" +station="Hobs, Counters ..." + [layer_names] 3d_physics/layer_1="Static World" @@ -55,6 +60,7 @@ import/blender/enabled=false [rendering] rendering_device/driver.windows="d3d12" +renderer/rendering_method="gl_compatibility" renderer/rendering_method.mobile="gl_compatibility" [xr]