diff --git a/BurgerBunsDispenser.tscn b/BurgerBunsDispenser.tscn new file mode 100644 index 0000000..5dc4a1d --- /dev/null +++ b/BurgerBunsDispenser.tscn @@ -0,0 +1,173 @@ +[gd_scene format=3 uid="uid://c6rift56ql3f8"] + +[ext_resource type="Script" uid="uid://0y6wnjcsum6" path="res://item_dispenser.gd" id="1_myl3s"] +[ext_resource type="Script" uid="uid://cquqe4f1m1sw6" path="res://addons/godot-xr-tools/objects/snap_zone.gd" id="1_p30r1"] +[ext_resource type="PackedScene" uid="uid://c0lknik4noobs" path="res://BurgerBuns.tscn" id="2_1q74o"] + +[sub_resource type="SphereShape3D" id="SphereShape3D_xmbo2"] +radius = 0.3 + +[sub_resource type="CylinderShape3D" id="CylinderShape3D_24d3s"] + +[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_vlqg6"] +albedo_color = Color(0.6784191, 0.54546416, 0.016760282, 1) + +[node name="BurgerBunsDispenser" type="StaticBody3D" unique_id=1720683779] +script = ExtResource("1_myl3s") +item_scene = ExtResource("2_1q74o") + +[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=805334513] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00070536137, 1.0162505, -0.002165556) +collision_layer = 65536 +collision_mask = 65536 +script = ExtResource("1_p30r1") +snap_mode = 1 +initial_object = NodePath("../../BurgerBuns") +metadata/_custom_type_script = "uid://cquqe4f1m1sw6" + +[node name="CollisionShape3D" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=1104626493] +shape = SubResource("SphereShape3D_xmbo2") + +[node name="CollisionShape3D" type="CollisionShape3D" parent="." unique_id=1470079357] +shape = SubResource("CylinderShape3D_24d3s") + +[node name="CSGCombiner3D" type="CSGCombiner3D" parent="." unique_id=1746426494] + +[node name="CSGCylinder3D" type="CSGCylinder3D" parent="CSGCombiner3D" unique_id=858311379] +radius = 0.4 +sides = 32 + +[node name="CSGCombiner3DBuns" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=1459017790] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.108142376, 1.0341886, -0.19146484) +autosmooth = true +smoothing_angle = 138.9 + +[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns" unique_id=1328221793] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.004122257, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns" unique_id=686624728] +transform = Transform3D(0.82770383, -0.5611652, 0, 0.5611652, 0.82770383, 0, 0, 0, 1, -0.048392475, 0.029736161, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns/CSGCylinder3D3" unique_id=1113894081] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.9604645e-08, 0.040259957, 0) +radius = 0.1 +height = 0.04 +sides = 16 +cone = true +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCombiner3DBuns2" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=1636439623] +transform = Transform3D(0.42896286, 0, -0.90332216, 0, 1, 0, 0.90332216, 0, 0.42896286, 0.13564643, 1.0341886, 0.20497215) +autosmooth = true +smoothing_angle = 138.9 + +[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns2" unique_id=190780737] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.004122257, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns2" unique_id=557804311] +transform = Transform3D(0.82770383, -0.5611652, 0, 0.5611652, 0.82770383, 0, 0, 0, 1, -0.048392475, 0.029736161, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns2/CSGCylinder3D3" unique_id=605379447] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.9604645e-08, 0.040259957, 0) +radius = 0.1 +height = 0.04 +sides = 16 +cone = true +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCombiner3DBuns3" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=1594575583] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.17070979, 1.0341885, 0.07147646) +autosmooth = true +smoothing_angle = 138.9 + +[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns3" unique_id=1686142490] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.004122257, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns3" unique_id=1773290691] +transform = Transform3D(0.82770383, -0.5611652, 0, 0.5611652, 0.82770383, 0, 0, 0, 1, -0.048392475, 0.029736161, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns3/CSGCylinder3D3" unique_id=801922493] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.9604645e-08, 0.040259957, 0) +radius = 0.1 +height = 0.04 +sides = 16 +cone = true +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCombiner3DBuns4" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=2055085730] +transform = Transform3D(0.95670986, 0, 0.29104328, 0, 1, 0, -0.29104328, 0, 0.95670986, -0.14758292, 1.0341886, -0.1304872) +autosmooth = true +smoothing_angle = 138.9 + +[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns4" unique_id=547208858] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.004122257, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns4" unique_id=185898007] +transform = Transform3D(0.82770383, -0.5611652, 0, 0.5611652, 0.82770383, 0, 0, 0, 1, -0.048392475, 0.029736161, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns4/CSGCylinder3D3" unique_id=2117029178] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.9604645e-08, 0.040259957, 0) +radius = 0.1 +height = 0.04 +sides = 16 +cone = true +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCombiner3DBuns5" type="CSGCombiner3D" parent="CSGCombiner3D" unique_id=546748728] +transform = Transform3D(0.20608562, 0, -0.978534, 0, 1, 0, 0.978534, 0, 0.20608562, -0.082762055, 1.0341886, 0.2722176) +autosmooth = true +smoothing_angle = 138.9 + +[node name="CSGCylinder3D2" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns5" unique_id=102374914] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.004122257, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D3" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns5" unique_id=189923990] +transform = Transform3D(0.82770383, -0.5611652, 0, 0.5611652, 0.82770383, 0, 0, 0, 1, -0.048392475, 0.029736161, 0) +radius = 0.1 +height = 0.04 +sides = 16 +material = SubResource("StandardMaterial3D_vlqg6") + +[node name="CSGCylinder3D4" type="CSGCylinder3D" parent="CSGCombiner3D/CSGCombiner3DBuns5/CSGCylinder3D3" unique_id=1980594001] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 5.9604645e-08, 0.040259957, 0) +radius = 0.1 +height = 0.04 +sides = 16 +cone = true +material = SubResource("StandardMaterial3D_vlqg6") diff --git a/JonScene.tscn b/JonScene.tscn new file mode 100644 index 0000000..45fcd7f --- /dev/null +++ b/JonScene.tscn @@ -0,0 +1,69 @@ +[gd_scene format=3 uid="uid://do6mrslyqe5qe"] + +[ext_resource type="Script" uid="uid://b4ldkd3ngs0vp" path="res://main.gd" id="1_2yrrf"] +[ext_resource type="PackedScene" uid="uid://j5s5wus7tuhb" path="res://XROrigin.tscn" id="2_lc11c"] +[ext_resource type="Material" uid="uid://cmia50cfqxxo4" path="res://Textures/dev_material_3d.tres" id="3_wlcqk"] +[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Hob.tscn" id="4_cposl"] +[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Counter.tscn" id="5_rbb5l"] +[ext_resource type="PackedScene" uid="uid://e4i6o5oriecx" path="res://PickupCube.tscn" id="6_65p64"] +[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="7_a81vl"] +[ext_resource type="PackedScene" uid="uid://c0lknik4noobs" path="res://BurgerBuns.tscn" id="8_wlcqk"] +[ext_resource type="PackedScene" uid="uid://c6rift56ql3f8" path="res://BurgerBunsDispenser.tscn" id="9_wlcqk"] + +[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"] +size = Vector3(5, 0.1, 5) + +[sub_resource type="BoxMesh" id="BoxMesh_24d3s"] +material = ExtResource("3_wlcqk") +size = Vector3(5, 0.1, 5) + +[sub_resource type="Environment" id="Environment_bvwq1"] +background_mode = 2 +sky = ExtResource("7_a81vl") +reflected_light_source = 2 +ssr_enabled = true +ssao_enabled = true +ssil_enabled = true +sdfgi_enabled = true + +[node name="Main" type="Node3D" unique_id=1312265607] +script = ExtResource("1_2yrrf") + +[node name="XROrigin3D" parent="." unique_id=2055526621 instance=ExtResource("2_lc11c")] + +[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=1376644384] +transform = Transform3D(-0.8660254, -0.43301278, 0.24999999, 0.3022632, -0.05510214, 0.9516306, -0.39829266, 0.8997021, 0.17860365, 0, 0, 0) + +[node name="Floor" type="StaticBody3D" parent="." unique_id=122279514] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.05, 0) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Floor" unique_id=958841648] +shape = SubResource("BoxShape3D_vlqg6") + +[node name="MeshInstance3D" type="MeshInstance3D" parent="Floor/CollisionShape3D" unique_id=1939997056] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00018164515, 0.0006352663, -0.002532661) +mesh = SubResource("BoxMesh_24d3s") + +[node name="Hob" parent="." unique_id=1687971542 instance=ExtResource("4_cposl")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.29336345, 0.8981018, -1.484) + +[node name="Counter" parent="." unique_id=1487893288 instance=ExtResource("5_rbb5l")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.73186195, 0.8981018, -1.484) + +[node name="PickableObject" parent="." unique_id=1675596942 instance=ExtResource("6_65p64")] +transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, -0.70505303, 1.5761534, -1.0317149) + +[node name="PickableObject2" parent="." unique_id=713087634 instance=ExtResource("6_65p64")] +transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6077032e-08, 1.4901161e-08, 1, 0.28315204, 1.5607953, -1.0657519) + +[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250] +environment = SubResource("Environment_bvwq1") + +[node name="BurgerBuns" parent="." unique_id=1088240294 instance=ExtResource("8_wlcqk")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8162017, 1.6081157, -1.4714175) + +[node name="BurgerBunsDispenser" parent="." unique_id=1720683779 instance=ExtResource("9_wlcqk")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.832131, 0.40028095, -1.4813508) + +[node name="BurgerBuns2" parent="." unique_id=1909843084 instance=ExtResource("8_wlcqk")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.1282921, 1.4976386, -1.0923254) diff --git a/hob.gd b/hob.gd index 763c6cc..05df105 100644 --- a/hob.gd +++ b/hob.gd @@ -40,7 +40,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) + #print("Picked obj:", snap_zone.picked_up_object) # Find the CookableItem in held object var cookable = null diff --git a/item_dispenser.gd b/item_dispenser.gd new file mode 100644 index 0000000..22794eb --- /dev/null +++ b/item_dispenser.gd @@ -0,0 +1,22 @@ +extends StaticBody3D + +@export var item_scene : PackedScene +@onready var snap_zone: XRToolsSnapZone = $XRToolsSnapZone + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + if not item_scene: + push_error("Item dispenser is missing a reference to it's item to dispense") + if not snap_zone: + push_error("Item dispenser is missing a reference to its snap zone child") + + +# Called every frame. 'delta' is the elapsed time since the previous frame. +func _process(delta: float) -> void: + if not snap_zone.picked_up_object: + var new_item = item_scene.instantiate() + + # Add the new item to the hob's parent (so it lives in the main world space) + get_parent().add_child(new_item) + new_item.global_transform = snap_zone.transform + snap_zone.pick_up_object(new_item) diff --git a/item_dispenser.gd.uid b/item_dispenser.gd.uid new file mode 100644 index 0000000..66835a2 --- /dev/null +++ b/item_dispenser.gd.uid @@ -0,0 +1 @@ +uid://0y6wnjcsum6