This commit is contained in:
JonShard
2026-07-14 19:20:21 +02:00
20 changed files with 269 additions and 135 deletions
+15
View File
@@ -6,12 +6,17 @@
[ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="4_mgacb"]
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="5_vw7i6"]
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_cp3eg"]
[ext_resource type="Script" path="res://combinable_item.gd" id="7_comb"]
[ext_resource type="Script" path="res://combine_zone.gd" id="8_zone"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_gkni8"]
custom_solver_bias = 0.1
height = 0.1
radius = 0.1
[sub_resource type="BoxShape3D" id="BoxShape3D_combine"]
size = Vector3(0.16, 0.16, 0.16)
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e28iu"]
albedo_color = Color(0.06879827, 0.06879828, 0.06879828, 1)
@@ -46,3 +51,13 @@ hand_pose = SubResource("Resource_lc22d")
[node name="GrabPointHandRight" parent="." index="3" unique_id=514404634 instance=ExtResource("5_vw7i6")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06531982, 0.042291984, -0.08604182)
hand_pose = SubResource("Resource_qyiot")
[node name="CombinableItem" type="Node" parent="." index="4"]
script = ExtResource("7_comb")
id = &"charcoal"
[node name="CombineZone" type="Area3D" parent="." index="5"]
script = ExtResource("8_zone")
[node name="CollisionShape3D" type="CollisionShape3D" parent="CombineZone"]
shape = SubResource("BoxShape3D_combine")
+5 -5
View File
@@ -6,7 +6,7 @@
[sub_resource type="BoxMesh" id="BoxMesh_i5j2u"]
[sub_resource type="SphereShape3D" id="SphereShape3D_vlqg6"]
[sub_resource type="SphereShape3D" id="SphereShape3D_dlkho"]
[node name="Counter" type="StaticBody3D" unique_id=1487893288]
@@ -20,14 +20,14 @@ 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=186065581]
[node name="XRToolsSnapZone" type="Area3D" parent="." unique_id=1647380272]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5270121, 0)
collision_layer = 0
collision_layer = 65536
collision_mask = 65536
script = ExtResource("1_dlkho")
snap_mode = 1
metadata/_custom_type_script = "uid://cquqe4f1m1sw6"
[node name="CollisionShape3D2" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=1196349092]
[node name="CollisionShape3D2" type="CollisionShape3D" parent="XRToolsSnapZone" unique_id=969340130]
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 0, -0.000975132, 0)
shape = SubResource("SphereShape3D_vlqg6")
shape = SubResource("SphereShape3D_dlkho")
+22
View File
@@ -8,6 +8,9 @@
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="6_bdp75"]
[ext_resource type="Script" uid="uid://bs7cxydoxk1cx" path="res://cookable_item.gd" id="7_hc3f7"]
[ext_resource type="PackedScene" uid="uid://cucc3gaqu2nab" path="res://Charcoal.tscn" id="8_a0a5b"]
[ext_resource type="Script" uid="uid://dounic663dn5q" path="res://combinable_item.gd" id="9_comb"]
[ext_resource type="Script" uid="uid://e3im02nq5cye" path="res://combine_zone.gd" id="10_zone"]
[ext_resource type="Script" uid="uid://coidnv8b2yvxr" path="res://combine_recipe.gd" id="11_recipe"]
[sub_resource type="BoxShape3D" id="BoxShape3D_m1xbq"]
size = Vector3(0.1, 0.1, 0.1)
@@ -29,6 +32,14 @@ script = ExtResource("4_hc3f7")
closed_pose = ExtResource("6_bdp75")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="Resource" id="Resource_recipe_cube"]
script = ExtResource("11_recipe")
ingredient_id = &"cube"
result = ExtResource("8_a0a5b")
[sub_resource type="BoxShape3D" id="BoxShape3D_combine"]
size = Vector3(0.16, 0.16, 0.16)
[node name="PickableObject" unique_id=1675596942 instance=ExtResource("1_dbtw8")]
[node name="CollisionShape3D" parent="." index="0"]
@@ -49,3 +60,14 @@ hand_pose = SubResource("Resource_qyiot")
script = ExtResource("7_hc3f7")
cooking_time = 2.0
turns_into = ExtResource("8_a0a5b")
[node name="CombinableItem" type="Node" parent="." index="5" unique_id=1265358312]
script = ExtResource("9_comb")
id = &"cube"
recipes = Array[ExtResource("11_recipe")]([SubResource("Resource_recipe_cube")])
[node name="CombineZone" type="Area3D" parent="." index="6" unique_id=1412308162]
script = ExtResource("10_zone")
[node name="CollisionShape3D" type="CollisionShape3D" parent="CombineZone" index="0" unique_id=1926800015]
shape = SubResource("BoxShape3D_combine")
+3 -1
View File
@@ -10,4 +10,6 @@ uv1_triplanar = true
[resource]
next_pass = SubResource("StandardMaterial3D_0gbf8")
albedo_color = Color(0.16497248, 0.49238974, 0.43831292, 1)
metallic = 1.0
metallic_specular = 0.0
roughness = 0.0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 155 KiB

-40
View File
@@ -1,40 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bkybj43vsb8a8"
path="res://.godot/imported/DaySkyHDRI055B.png-c08c948c1cd92f9f6279c40d25a56f13.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://Textures/sky/DaySkyHDRI055B.png"
dest_files=["res://.godot/imported/DaySkyHDRI055B.png-c08c948c1cd92f9f6279c40d25a56f13.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1
-6
View File
@@ -1,6 +0,0 @@
[gd_resource type="Sky" load_steps=3 format=3 uid="uid://acg_omgsazfy"]
[ext_resource type="Texture2D" uid="uid://acg_o5ei9d13" path="./DaySkyHDRI055B_16K_HDR.exr" id="acg_2cd05t89"]
[sub_resource type="PanoramaSkyMaterial" id="acg_y6m9krn2"]
panorama = ExtResource("acg_2cd05t89")
[resource]
sky_material = SubResource("acg_y6m9krn2")
Binary file not shown.
@@ -1,41 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c6gfr7v6da0ku"
path.bptc="res://.godot/imported/DaySkyHDRI055B_16K_HDR.exr-a051741763bd70c547bfd0969bdc0ec5.bptc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Textures/sky/DaySkyHDRI055B_16K_HDR.exr"
dest_files=["res://.godot/imported/DaySkyHDRI055B_16K_HDR.exr-a051741763bd70c547bfd0969bdc0ec5.bptc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 MiB

@@ -1,41 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bd6c12infl67q"
path.s3tc="res://.godot/imported/DaySkyHDRI055B_16K_TONEMAPPED.jpg-650d4fd5fe07348b21db82dbb2b39a11.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://Textures/sky/DaySkyHDRI055B_16K_TONEMAPPED.jpg"
dest_files=["res://.godot/imported/DaySkyHDRI055B_16K_TONEMAPPED.jpg-650d4fd5fe07348b21db82dbb2b39a11.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0
+74
View File
@@ -0,0 +1,74 @@
[gd_scene format=3 uid="uid://dpot5qie20vf6"]
[ext_resource type="PackedScene" uid="uid://c8l60rnugru40" path="res://addons/godot-xr-tools/objects/pickable.tscn" id="1_fco8w"]
[ext_resource type="Texture2D" uid="uid://cexxfyw03hr81" path="res://Textures/1.png" id="2_r8jvx"]
[ext_resource type="PackedScene" uid="uid://c25yxb0vt53vc" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_left.tscn" id="3_qixic"]
[ext_resource type="Animation" uid="uid://db62hs5s4n2b3" path="res://addons/godot-xr-tools/hands/animations/left/Grip 4.res" id="4_bw8vh"]
[ext_resource type="Script" uid="uid://dvobm6vcfnqe8" path="res://addons/godot-xr-tools/hands/poses/hand_pose_settings.gd" id="5_w8sii"]
[ext_resource type="PackedScene" uid="uid://ctw7nbntd5pcj" path="res://addons/godot-xr-tools/objects/grab_points/grab_point_hand_right.tscn" id="6_mvnl5"]
[ext_resource type="Animation" uid="uid://d1xnpyc08njjx" path="res://addons/godot-xr-tools/hands/animations/right/Grip 4.res" id="7_wqxjj"]
[ext_resource type="Script" uid="uid://bs7cxydoxk1cx" path="res://cookable_item.gd" id="8_t4l03"]
[ext_resource type="PackedScene" uid="uid://cucc3gaqu2nab" path="res://Charcoal.tscn" id="9_x1g8b"]
[ext_resource type="Script" uid="uid://dounic663dn5q" path="res://combinable_item.gd" id="10_qe0ug"]
[ext_resource type="Script" uid="uid://coidnv8b2yvxr" path="res://combine_recipe.gd" id="11_dq5p0"]
[ext_resource type="Script" uid="uid://e3im02nq5cye" path="res://combine_zone.gd" id="12_7llnd"]
[sub_resource type="CylinderShape3D" id="CylinderShape3D_fco8w"]
height = 0.063323975
radius = 0.12011719
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_bvwq1"]
albedo_texture = ExtResource("2_r8jvx")
[sub_resource type="Resource" id="Resource_lc22d"]
script = ExtResource("5_w8sii")
closed_pose = ExtResource("4_bw8vh")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="Resource" id="Resource_qyiot"]
script = ExtResource("5_w8sii")
closed_pose = ExtResource("7_wqxjj")
metadata/_custom_type_script = "uid://dvobm6vcfnqe8"
[sub_resource type="Resource" id="Resource_recipe_cube"]
script = ExtResource("11_dq5p0")
ingredient_id = &"cube"
result = ExtResource("9_x1g8b")
[sub_resource type="BoxShape3D" id="BoxShape3D_combine"]
size = Vector3(0.16, 0.16, 0.16)
[node name="burger" unique_id=1675596942 instance=ExtResource("1_fco8w")]
[node name="CollisionShape3D" parent="." index="0"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.0005453825, 0)
shape = SubResource("CylinderShape3D_fco8w")
[node name="CSGCylinder3D" type="CSGCylinder3D" parent="." index="1" unique_id=59319982]
radius = 0.1
height = 0.03
material = SubResource("StandardMaterial3D_bvwq1")
[node name="GrabPointHandLeft" parent="." index="2" unique_id=1571481674 instance=ExtResource("3_qixic")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.067650706, 0.04601878, -0.08606844)
hand_pose = SubResource("Resource_lc22d")
[node name="GrabPointHandRight" parent="." index="3" unique_id=514404634 instance=ExtResource("6_mvnl5")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.06531982, 0.042291984, -0.08604182)
hand_pose = SubResource("Resource_qyiot")
[node name="CookableItem" type="Node" parent="." index="4" unique_id=1139889801]
script = ExtResource("8_t4l03")
cooking_time = 2.0
turns_into = ExtResource("9_x1g8b")
[node name="CombinableItem" type="Node" parent="." index="5" unique_id=1265358312]
script = ExtResource("10_qe0ug")
id = &"burger"
recipes = Array[ExtResource("11_dq5p0")]([SubResource("Resource_recipe_cube")])
[node name="CombineZone" type="Area3D" parent="." index="6" unique_id=1412308162]
script = ExtResource("12_7llnd")
[node name="CollisionShape3D" type="CollisionShape3D" parent="CombineZone" index="0" unique_id=1926800015]
shape = SubResource("BoxShape3D_combine")
+24
View File
@@ -0,0 +1,24 @@
class_name CombinableItem
extends Node
## Identity of this item, referenced by other items' recipes.
@export var id: StringName
## Recipes describing what the item holding this component turns into when
## another item is combined into it while snapped. Recipes are directional:
## only the snapped (base) item's recipes are consulted.
@export var recipes: Array[CombineRecipe] = []
func _ready() -> void:
if id.is_empty():
push_error("CombinableItem on ", get_parent().name, " has no 'id' set.")
## Returns the scene this item becomes when combined with [param other_id],
## or null if there is no matching recipe.
func get_result_for(other_id: StringName) -> PackedScene:
for recipe in recipes:
if recipe and recipe.ingredient_id == other_id:
return recipe.result
return null
+1
View File
@@ -0,0 +1 @@
uid://dounic663dn5q
+8
View File
@@ -0,0 +1,8 @@
class_name CombineRecipe
extends Resource
## The [CombinableItem.id] of the item that must be combined into the base item.
@export var ingredient_id: StringName
## The scene the base item turns into when [member ingredient_id] is combined in.
@export var result: PackedScene
+1
View File
@@ -0,0 +1 @@
uid://coidnv8b2yvxr
+103
View File
@@ -0,0 +1,103 @@
class_name CombineZone
extends Area3D
## Trigger area that lets a snapped item combine with another item pushed into
## it. The zone only monitors while its owning item is held by an
## [XRToolsSnapZone]; when an item carrying a matching [CombinableItem.id]
## enters, the snapped (base) item transforms into the recipe result and the
## incoming item is consumed.
# The pickable this zone belongs to (its parent).
@onready var _item: XRToolsPickable = get_parent() as XRToolsPickable
# The base item's recipe data.
@onready var _combinable: CombinableItem = _find_combinable(_item)
# Guard so a combine only fires once.
var _combining: bool = false
func _ready() -> void:
# Detect items whether held (layer 17 "Held Objects") or loose
# (layer 3 "Pickable Objects"). Don't advertise a layer of our own.
collision_mask = 0b0000_0000_0000_0001_0000_0000_0000_0100
collision_layer = 0
# Deferred: _ready can run during a physics signal flush (when a combine
# spawns the result), where toggling monitoring directly is forbidden.
set_deferred("monitoring", false)
set_deferred("monitorable", false)
if not _item:
push_error("CombineZone must be a child of an XRToolsPickable.")
return
if not _combinable:
push_error("CombineZone requires a CombinableItem sibling on ", _item.name, ".")
return
_item.picked_up.connect(_on_item_picked_up)
_item.dropped.connect(_on_item_dropped)
body_entered.connect(_on_body_entered)
# Enable the trigger only while snapped into a snap zone (not hand-held).
func _on_item_picked_up(_pickable: Node3D) -> void:
var by := _item.get_picked_up_by()
var snapped: bool = by != null and by.has_method("is_xr_class") and by.is_xr_class("XRToolsSnapZone")
set_deferred("monitoring", snapped)
func _on_item_dropped(_pickable: Node3D) -> void:
set_deferred("monitoring", false)
func _on_body_entered(body: Node3D) -> void:
if _combining or body == _item:
return
var other := _find_combinable(body)
if not other:
return
var result: PackedScene = _combinable.get_result_for(other.id)
if not result:
return
_combine(body, result)
# Transform the base item into [param result], consuming the incoming item.
func _combine(other_body: Node3D, result: PackedScene) -> void:
_combining = true
var snap_zone := _item.get_picked_up_by()
if not snap_zone or not snap_zone.has_method("pick_up_object"):
push_warning("CombineZone: base item is not held by a snap zone; cannot combine.")
_combining = false
return
# Spawn the result at the base item's location, in world space.
var base_transform := _item.global_transform
var result_instance: Node3D = result.instantiate()
_item.get_tree().current_scene.add_child(result_instance)
result_instance.global_transform = base_transform
# Free the base item and consume the incoming item.
snap_zone.drop_object()
_item.queue_free()
if other_body.has_method("drop_and_free"):
other_body.drop_and_free()
else:
other_body.queue_free()
# Snap the result into the now-empty zone.
snap_zone.pick_up_object(result_instance)
# Find a CombinableItem among the direct children of [param node].
func _find_combinable(node: Node) -> CombinableItem:
if not node:
return null
for child in node.get_children():
if child is CombinableItem:
return child
return null
+1
View File
@@ -0,0 +1 @@
uid://e3im02nq5cye
+12
View File
@@ -7,6 +7,7 @@
[ext_resource type="PackedScene" uid="uid://j7caslh27nor" path="res://Hob.tscn" id="3_lquwl"]
[ext_resource type="PackedScene" uid="uid://efaec6ymgabo" path="res://Counter.tscn" id="4_7mycd"]
[ext_resource type="Sky" uid="uid://c1abtpwhdm2d5" path="res://Textures/sky/NightSkyHDRI009_16K.tres" id="6_7mycd"]
[ext_resource type="PackedScene" uid="uid://dpot5qie20vf6" path="res://burger.tscn" id="8_5vw27"]
[sub_resource type="BoxShape3D" id="BoxShape3D_vlqg6"]
size = Vector3(5, 0.1, 5)
@@ -19,6 +20,7 @@ size = Vector3(5, 0.1, 5)
background_mode = 2
sky = ExtResource("6_7mycd")
reflected_light_source = 2
tonemap_mode = 3
ssr_enabled = true
ssao_enabled = true
ssil_enabled = true
@@ -56,3 +58,13 @@ transform = Transform3D(1, 0, -2.2351742e-08, -2.9802322e-08, 1.0000001, 0, -2.6
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1177077250]
environment = SubResource("Environment_bvwq1")
[node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=812168256]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2856425, 1.4939771, -1.4959787)
visible = false
light_color = Color(1, 0.38431373, 0, 1)
light_energy = 1.784
shadow_enabled = true
[node name="PickableObject3" parent="." unique_id=1428188966 instance=ExtResource("8_5vw27")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.572903, -1.1190817)
-1
View File
@@ -55,7 +55,6 @@ import/blender/enabled=false
[rendering]
rendering_device/driver.windows="d3d12"
renderer/rendering_method="gl_compatibility"
renderer/rendering_method.mobile="gl_compatibility"
[xr]