Interactive wall switch

This commit is contained in:
Rob Kelly 2025-03-05 14:46:13 -07:00
parent 89c3f6ff65
commit 1204123705
35 changed files with 749 additions and 76 deletions

View File

@ -0,0 +1,2 @@
# Blender 4.3.2 MTL File: 'wall_switch2.blend'
# www.blender.org

View File

@ -0,0 +1,188 @@
# Blender 4.3.2
# www.blender.org
mtllib wall_switch.mtl
o WallSwitch.2
v -0.190000 -0.270000 0.100000
v -0.190000 0.270000 0.100000
v -0.300000 -0.400000 -0.100000
v -0.300000 0.400000 -0.100000
v 0.240000 -0.320000 0.100000
v 0.240000 0.320000 0.100000
v 0.300000 -0.400000 -0.100000
v 0.300000 0.400000 -0.100000
v 0.050000 -0.270000 0.100000
v 0.050000 0.270000 0.100000
v 0.100000 0.320000 0.100000
v -0.240000 0.320000 0.100000
v -0.240000 -0.320000 0.100000
v 0.100000 -0.320000 0.100000
v 0.050000 0.270000 0.050000
v -0.190000 0.270000 0.050000
v -0.190000 -0.270000 0.050000
v 0.050000 -0.270000 0.050000
v -0.175000 0.195000 0.075000
v -0.175000 0.245000 0.075000
v -0.175000 0.195000 0.025000
v -0.175000 0.245000 0.025000
v 0.035000 0.195000 0.075000
v 0.035000 0.245000 0.075000
v 0.035000 0.195000 0.025000
v 0.035000 0.245000 0.025000
v 0.017500 0.195000 0.025000
v -0.157500 0.195000 0.025000
v -0.157500 0.245000 0.025000
v 0.017500 0.245000 0.025000
v -0.157500 0.195000 0.075000
v 0.017500 0.195000 0.075000
v 0.017500 0.245000 0.075000
v -0.157500 0.245000 0.075000
v -0.175000 -0.225000 0.025000
v -0.175000 -0.250000 0.050000
v -0.175000 -0.225000 0.075000
v -0.157500 -0.225000 0.025000
v 0.035000 -0.225000 0.075000
v 0.035000 -0.250000 0.050000
v 0.035000 -0.225000 0.025000
v 0.017500 -0.250000 0.050000
v 0.017500 -0.225000 0.075000
v 0.017500 -0.225000 0.025000
v -0.157500 -0.225000 0.075000
v -0.157500 -0.250000 0.050000
vn -0.9578 -0.0000 0.2873
vn -0.0000 -0.0000 -1.0000
vn 0.9578 -0.0000 0.2873
vn -0.0000 -0.9285 0.3714
vn -0.0000 0.9285 0.3714
vn -0.0000 -0.0000 1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -0.7071 -0.7071
vn -0.0000 -0.7071 0.7071
vt 0.109375 0.109375
vt 0.109375 0.453125
vt 0.000000 0.500000
vt -0.000000 0.078125
vt 0.078125 1.000000
vt 0.078125 0.578125
vt 0.406250 0.578125
vt 0.406250 1.000000
vt 0.484375 0.078125
vt 0.484375 0.500000
vt 0.375000 0.453125
vt 0.375000 0.109375
vt 0.078125 0.000000
vt 0.406250 0.000000
vt 0.296875 0.109375
vt 0.296875 0.453125
vt 0.968750 0.281250
vt 0.562500 0.281250
vt 0.562500 0.250000
vt 0.968750 0.250000
vt 0.140625 0.421875
vt 0.265625 0.421875
vt 0.140625 0.140625
vt 0.265625 0.140625
vt 0.562500 0.031250
vt 0.968750 0.031250
vt 0.531250 0.250000
vt 0.531250 0.031250
vt 1.000000 0.031250
vt 1.000000 0.250000
vt 0.562500 0.000000
vt 0.968750 0.000000
vt 0.750000 0.406250
vt 0.750000 0.343750
vt 0.812500 0.343750
vt 0.812500 0.406250
vt 0.828125 0.406250
vt 0.828125 0.343750
vt 0.843750 0.343750
vt 0.843750 0.406250
vt 0.906250 0.343750
vt 0.906250 0.406250
vt 0.734375 0.406250
vt 0.734375 0.343750
vt 0.937500 0.921875
vt 1.000000 0.921875
vt 0.968750 0.953125
vt 0.812500 0.328125
vt 0.750000 0.328125
vt 0.843750 0.328125
vt 0.906250 0.328125
vt 0.406250 0.718750
vt 0.671875 0.718750
vt 0.671875 0.812500
vt 0.406250 0.812500
vt 0.812500 0.921875
vt 0.750000 0.921875
vt 0.671875 1.000000
vt 0.406250 0.906250
vt 0.671875 0.906250
vt 0.937500 0.343750
vt 0.937500 0.406250
vt 0.671875 0.625000
vt 0.406250 0.625000
vt 0.906250 0.921875
vt 0.828125 0.921875
vt 0.843750 0.921875
vt 0.734375 0.921875
vt 0.875000 0.953125
vt 0.671875 0.921875
vt 0.703125 0.953125
vt 0.734375 0.953125
vt 0.750000 0.953125
vt 0.750000 1.000000
vt 0.734375 1.000000
vt 0.937500 0.953125
vt 0.906250 0.953125
vt 0.937500 1.000000
vt 0.906250 1.000000
vt 0.781250 0.953125
vt 0.671875 0.406250
vt 1.000000 0.406250
s 0
f 13/1/1 12/2/1 4/3/1 3/4/1
f 3/5/2 4/6/2 8/7/2 7/8/2
f 7/9/3 8/10/3 6/11/3 5/12/3
f 3/13/4 7/14/4 5/12/4 14/15/4 13/1/4
f 8/7/5 4/6/5 12/2/5 11/16/5 6/11/5
f 5/12/6 6/11/6 11/16/6 14/15/6
f 2/17/7 1/18/7 17/19/7 16/20/7
f 2/21/6 10/22/6 11/16/6 12/2/6
f 1/23/6 2/21/6 12/2/6 13/1/6
f 9/24/6 1/23/6 13/1/6 14/15/6
f 10/22/6 9/24/6 14/15/6 11/16/6
f 18/25/6 15/26/6 16/20/6 17/19/6
f 1/27/8 9/28/8 18/25/8 17/19/8
f 10/29/9 2/30/9 16/20/9 15/26/9
f 9/31/10 10/32/10 15/26/10 18/25/10
f 19/33/10 20/34/10 22/35/10 21/36/10
f 27/37/2 30/38/2 26/39/2 25/40/2
f 25/40/7 26/39/7 24/41/7 23/42/7
f 31/43/6 34/44/6 20/34/6 19/33/6
f 43/45/10 44/46/10 42/47/10
f 29/48/8 22/35/8 20/34/8 34/49/8
f 26/39/8 30/50/8 33/51/8 24/41/8
f 30/52/8 29/53/8 34/54/8 33/55/8
f 19/33/10 21/36/10 35/56/10 37/57/10
f 28/58/9 27/8/9 32/59/9 31/60/9
f 23/42/6 24/41/6 33/61/6 32/62/6
f 32/59/6 33/55/6 34/54/6 31/60/6
f 21/36/2 22/35/2 29/38/2 28/37/2
f 28/63/2 29/53/2 30/52/2 27/64/2
f 23/42/6 32/62/6 43/45/6 39/65/6
f 21/36/2 28/37/2 38/66/2 35/56/2
f 27/37/2 25/40/2 41/67/2 44/66/2
f 31/43/6 19/33/6 37/57/6 45/68/6
f 41/67/7 39/65/7 40/69/7
f 38/70/7 45/68/7 46/71/7
f 46/72/11 36/73/11 35/74/11 38/75/11
f 42/76/12 40/77/12 39/65/12 43/45/12
f 40/77/11 42/76/11 44/78/11 41/79/11
f 36/73/12 46/72/12 45/68/12 37/57/12
f 37/57/10 35/56/10 36/80/10
f 28/81/7 31/43/7 45/68/7 38/70/7
f 32/62/10 27/82/10 44/46/10 43/45/10
f 25/40/7 23/42/7 39/65/7 41/67/7

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
asset_dev/props/wall_switch/wall_switch_C.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
asset_dev/props/wall_switch/wall_switch_M.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
asset_dev/props/wall_switch/wall_switch_N.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
asset_dev/props/wall_switch/wall_switch_R.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -27,7 +27,7 @@ render_priority = 0
shader = ExtResource("1_euy6e")
shader_parameter/color_1 = Color(0, 0.03, 0.1, 1)
shader_parameter/color_2 = Color(0, 0.1, 0.3, 1)
shader_parameter/emission_color = Color(0.25, 0.875, 1, 1)
shader_parameter/emission_color = Color(0.25, 0.88, 1, 1)
shader_parameter/pixellation = 128.0
shader_parameter/time_pixellation = 30.0
shader_parameter/roughness = 0.15

View File

@ -24,25 +24,25 @@
{
"name":"Switch",
"rotation":[
0,
-2.980232594040899e-08,
1.1920928955078125e-07,
0,
1
],
"scale":[
0.9999999403953552,
0.9999999403953552,
0.9999999403953552
0.9999998211860657,
0.9999998211860657
],
"translation":[
-0.10576892644166946,
0.22247494757175446,
0.11068853735923767
0.14664649963378906,
0.07006558775901794
]
},
{
"mesh":0,
"name":"Handle",
"name":"WallSwitch.2",
"skin":0
},
{
@ -224,25 +224,9 @@
]
}
],
"materials":[
{
"doubleSided":true,
"name":"WallSwitch",
"pbrMetallicRoughness":{
"baseColorFactor":[
0.800000011920929,
0.800000011920929,
0.800000011920929,
1
],
"metallicFactor":0,
"roughnessFactor":0.5
}
}
],
"meshes":[
{
"name":"Cube.001",
"name":"Cube",
"primitives":[
{
"attributes":{
@ -252,8 +236,7 @@
"JOINTS_0":3,
"WEIGHTS_0":4
},
"indices":5,
"material":0
"indices":5
}
]
}
@ -272,47 +255,47 @@
{
"bufferView":0,
"componentType":5126,
"count":312,
"count":140,
"max":[
0.3149999976158142,
0.3999999761581421,
0.12200002372264862
0.30000001192092896,
0.4000000059604645,
0.09999999403953552
],
"min":[
-0.3149999976158142,
-0.3999999761581421,
-0.11000002920627594
-0.30000001192092896,
-0.4000000059604645,
-0.09999999403953552
],
"type":"VEC3"
},
{
"bufferView":1,
"componentType":5126,
"count":312,
"count":140,
"type":"VEC3"
},
{
"bufferView":2,
"componentType":5126,
"count":312,
"count":140,
"type":"VEC2"
},
{
"bufferView":3,
"componentType":5121,
"count":312,
"count":140,
"type":"VEC4"
},
{
"bufferView":4,
"componentType":5126,
"count":312,
"count":140,
"type":"VEC4"
},
{
"bufferView":5,
"componentType":5123,
"count":564,
"count":252,
"type":"SCALAR"
},
{
@ -433,124 +416,124 @@
"bufferViews":[
{
"buffer":0,
"byteLength":3744,
"byteLength":1680,
"byteOffset":0,
"target":34962
},
{
"buffer":0,
"byteLength":3744,
"byteOffset":3744,
"byteLength":1680,
"byteOffset":1680,
"target":34962
},
{
"buffer":0,
"byteLength":2496,
"byteOffset":7488,
"byteLength":1120,
"byteOffset":3360,
"target":34962
},
{
"buffer":0,
"byteLength":1248,
"byteOffset":9984,
"byteLength":560,
"byteOffset":4480,
"target":34962
},
{
"buffer":0,
"byteLength":4992,
"byteOffset":11232,
"byteLength":2240,
"byteOffset":5040,
"target":34962
},
{
"buffer":0,
"byteLength":1128,
"byteOffset":16224,
"byteLength":504,
"byteOffset":7280,
"target":34963
},
{
"buffer":0,
"byteLength":128,
"byteOffset":17352
"byteOffset":7784
},
{
"buffer":0,
"byteLength":8,
"byteOffset":17480
"byteOffset":7912
},
{
"buffer":0,
"byteLength":24,
"byteOffset":17488
"byteOffset":7920
},
{
"buffer":0,
"byteLength":32,
"byteOffset":17512
"byteOffset":7944
},
{
"buffer":0,
"byteLength":24,
"byteOffset":17544
"byteOffset":7976
},
{
"buffer":0,
"byteLength":24,
"byteOffset":17568
"byteOffset":8000
},
{
"buffer":0,
"byteLength":540,
"byteOffset":17592
"byteOffset":8024
},
{
"buffer":0,
"byteLength":2160,
"byteOffset":18132
"byteOffset":8564
},
{
"buffer":0,
"byteLength":24,
"byteOffset":20292
"byteOffset":10724
},
{
"buffer":0,
"byteLength":4,
"byteOffset":20316
"byteOffset":10748
},
{
"buffer":0,
"byteLength":12,
"byteOffset":20320
"byteOffset":10752
},
{
"buffer":0,
"byteLength":16,
"byteOffset":20332
"byteOffset":10764
},
{
"buffer":0,
"byteLength":12,
"byteOffset":20348
"byteOffset":10780
},
{
"buffer":0,
"byteLength":12,
"byteOffset":20360
"byteOffset":10792
},
{
"buffer":0,
"byteLength":16,
"byteOffset":20372
"byteOffset":10804
},
{
"buffer":0,
"byteLength":12,
"byteOffset":20388
"byteOffset":10820
}
],
"buffers":[
{
"byteLength":20400,
"byteLength":10832,
"uri":"wall_switch.bin"
}
]

View File

@ -3,7 +3,7 @@
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b7nqbny1xop8t"
uid="uid://d0yq007888oq5"
path="res://.godot/imported/wall_switch.gltf-66cf36f473896d0320315d5127bdf889.scn"
[deps]

BIN
assets/props/wall_switch/wall_switch_C.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://1wjcyqynwlb6"
path="res://.godot/imported/wall_switch_C.png-1aac2c3e3e66ff48b393a731a3060d88.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/props/wall_switch/wall_switch_C.png"
dest_files=["res://.godot/imported/wall_switch_C.png-1aac2c3e3e66ff48b393a731a3060d88.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

BIN
assets/props/wall_switch/wall_switch_M.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bur4dtt4irwgd"
path="res://.godot/imported/wall_switch_M.png-9192c905baea18e55c3a8b99e5303230.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/props/wall_switch/wall_switch_M.png"
dest_files=["res://.godot/imported/wall_switch_M.png-9192c905baea18e55c3a8b99e5303230.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

BIN
assets/props/wall_switch/wall_switch_N.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ddve6jcfcuthx"
path="res://.godot/imported/wall_switch_N.png-ed33428ca1cb455566c9f4e1ba885254.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/props/wall_switch/wall_switch_N.png"
dest_files=["res://.godot/imported/wall_switch_N.png-ed33428ca1cb455566c9f4e1ba885254.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=1
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=1
roughness/src_normal="res://assets/props/wall_switch/wall_switch_N.png"
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

BIN
assets/props/wall_switch/wall_switch_R.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://rq5e0a3sco88"
path="res://.godot/imported/wall_switch_R.png-af958cc33d7624f7ffe7066d18ee57f9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://assets/props/wall_switch/wall_switch_R.png"
dest_files=["res://.godot/imported/wall_switch_R.png-af958cc33d7624f7ffe7066d18ee57f9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
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/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

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=28 format=3 uid="uid://16ds4fvv72xk"]
[gd_scene load_steps=29 format=3 uid="uid://16ds4fvv72xk"]
[ext_resource type="PackedScene" uid="uid://c2omlx4ptrc01" path="res://src/world/gunk_body/gunk_body.tscn" id="1_a67lu"]
[ext_resource type="PackedScene" uid="uid://bwe2jdmvinhqd" path="res://src/player/player.tscn" id="1_h436a"]
@ -9,6 +9,7 @@
[ext_resource type="ArrayMesh" uid="uid://bwgiytiic3t32" path="res://assets/props/cube/cube.obj" id="6_4kku3"]
[ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="6_l64ek"]
[ext_resource type="ArrayMesh" uid="uid://dchtriuljuloj" path="res://assets/props/cylinder/cylinder.obj" id="7_gn6k6"]
[ext_resource type="PackedScene" uid="uid://b6eg8t04rkh0c" path="res://src/props/wall_switch/wall_switch.tscn" id="9_p27ol"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_cj8bk"]
@ -152,8 +153,9 @@ skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Geometry/Floor"]
shape = SubResource("WorldBoundaryShape3D_c8g65")
[node name="Icosahedron" parent="Geometry" instance=ExtResource("1_a67lu")]
[node name="Icosahedron" parent="Geometry" node_paths=PackedStringArray("mesh_instance") instance=ExtResource("1_a67lu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.35498, 1.13294, -2.81423)
mesh_instance = NodePath("MeshInstance3D")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Geometry/Icosahedron"]
mesh = ExtResource("1_kvwui")
@ -163,8 +165,9 @@ surface_material_override/0 = ExtResource("3_o7v4k")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Geometry/Icosahedron"]
shape = SubResource("ConcavePolygonShape3D_nxc47")
[node name="Monkey" parent="Geometry" instance=ExtResource("1_a67lu")]
[node name="Monkey" parent="Geometry" node_paths=PackedStringArray("mesh_instance") instance=ExtResource("1_a67lu")]
transform = Transform3D(-0.616239, 0, 0.787559, 0, 1, 0, -0.787559, 0, -0.616239, -2.22512, 1.41158, 2.88581)
mesh_instance = NodePath("MeshInstance3D")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Geometry/Monkey"]
mesh = ExtResource("4_o55bf")
@ -174,9 +177,10 @@ surface_material_override/0 = SubResource("StandardMaterial3D_inlin")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Geometry/Monkey"]
shape = SubResource("ConcavePolygonShape3D_hvf6a")
[node name="Cube" parent="Geometry" instance=ExtResource("1_a67lu")]
[node name="Cube" parent="Geometry" node_paths=PackedStringArray("mesh_instance") instance=ExtResource("1_a67lu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 4, 0)
mask_dim = 1024
mesh_instance = NodePath("MeshInstance3D")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Geometry/Cube"]
mesh = ExtResource("6_4kku3")
@ -185,9 +189,10 @@ surface_material_override/0 = SubResource("StandardMaterial3D_chcw1")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Geometry/Cube"]
shape = SubResource("ConcavePolygonShape3D_0qjrr")
[node name="Cylinder" parent="Geometry" instance=ExtResource("1_a67lu")]
[node name="Cylinder" parent="Geometry" node_paths=PackedStringArray("mesh_instance") instance=ExtResource("1_a67lu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1.33738, 6, -7.18125)
mask_dim = 1024
mesh_instance = NodePath("MeshInstance3D")
[node name="MeshInstance3D" type="MeshInstance3D" parent="Geometry/Cylinder"]
mesh = ExtResource("7_gn6k6")
@ -197,4 +202,7 @@ surface_material_override/0 = SubResource("StandardMaterial3D_wjqpf")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Geometry/Cylinder"]
shape = SubResource("ConcavePolygonShape3D_6ood3")
[node name="WallSwitch" parent="Geometry" instance=ExtResource("9_p27ol")]
transform = Transform3D(-4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 3.9, 1.50699, 2.45659)
[node name="Player" parent="." instance=ExtResource("1_h436a")]

View File

@ -98,8 +98,15 @@ fire={
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
]
}
interact={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":69,"key_label":0,"unicode":101,"location":0,"echo":false,"script":null)
]
}
[layer_names]
3d_render/layer_1="World"
3d_render/layer_2="HUD"
3d_physics/layer_1="Physics"
3d_physics/layer_2="Interactive"

View File

@ -12,8 +12,13 @@ var gravity: Vector3 = (
* ProjectSettings.get_setting("physics/3d/default_gravity_vector")
)
var selected_interactive: Interactive
@onready var player_hud: PlayerHUD = %PlayerHUD
@onready var camera_pivot: Node3D = %CameraPivot
@onready var spray_muzzle: Marker3D = %SprayMuzzle
@onready var interact_ray: RayCast3D = %InteractRay
func get_speed() -> float:
@ -35,6 +40,8 @@ func get_spray() -> Spray:
func _physics_process(delta: float) -> void:
player_hud.select_interactive(interact_ray.get_collider() as Interactive)
if Input.is_action_pressed("fire"):
get_spray().fire()
else:

View File

@ -1,8 +1,10 @@
[gd_scene load_steps=6 format=3 uid="uid://bwe2jdmvinhqd"]
[gd_scene load_steps=8 format=3 uid="uid://bwe2jdmvinhqd"]
[ext_resource type="Script" path="res://src/player/player.gd" id="1_npueo"]
[ext_resource type="Script" path="res://src/player/camera_controller.gd" id="2_veeqv"]
[ext_resource type="PackedScene" uid="uid://cc102xko0u6yj" path="res://src/equipment/point_spray/point_spray.tscn" id="3_6wgkm"]
[ext_resource type="PackedScene" uid="uid://d2hnxr5l6w2x4" path="res://src/equipment/wide_spray/wide_spray.tscn" id="3_ibq07"]
[ext_resource type="PackedScene" uid="uid://dq1x21tq06dud" path="res://src/ui/hud/player_hud.tscn" id="5_jvafu"]
[sub_resource type="BoxMesh" id="BoxMesh_ua7a2"]
size = Vector3(0.05, 0.05, 0.3)
@ -28,9 +30,21 @@ unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.997564, -0.0697565, 0, 0.0697565, 0.997564, 0, 0, -0.15)
[node name="WideSpray" parent="CameraPivot/SprayNozzle/SprayMuzzle" instance=ExtResource("3_ibq07")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
[node name="PointSpray" parent="CameraPivot/SprayNozzle/SprayMuzzle" instance=ExtResource("3_6wgkm")]
visible = false
[node name="Camera3D" type="Camera3D" parent="CameraPivot"]
current = true
[node name="InteractRay" type="RayCast3D" parent="CameraPivot/Camera3D"]
unique_name_in_owner = true
target_position = Vector3(0, 0, -1.5)
collision_mask = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
shape = SubResource("CapsuleShape3D_s7f0r")
[node name="PlayerHUD" parent="." instance=ExtResource("5_jvafu")]
unique_name_in_owner = true

6
src/props/interactive.gd Normal file
View File

@ -0,0 +1,6 @@
class_name Interactive extends StaticBody3D
## Props the player can interact with.
signal activate
@export var disabled := false

View File

@ -0,0 +1 @@
extends Node3D

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,7 @@
[gd_resource type="Theme" format=3 uid="uid://b07fevr214mmr"]
[resource]
Label/colors/font_color = Color(1, 1, 1, 1)
Label/colors/font_outline_color = Color(0, 0, 0, 1)
Label/constants/outline_size = 16
Label/font_sizes/font_size = 32

37
src/ui/hud/player_hud.gd Normal file
View File

@ -0,0 +1,37 @@
class_name PlayerHUD extends Control
const TRANSITION_TIME := 0.05
const COLOR_VISIBLE := Color("#ffffffee")
const COLOR_DISABLED := Color("#cccccc44")
const COLOR_INVISIBLE := Color("#ffffff00")
@onready var interact_hud: Control = %InteractHUD
func _transition_color(element: CanvasItem, color: Color) -> void:
create_tween().tween_property(element, "modulate", color, TRANSITION_TIME).set_trans(
Tween.TRANS_CUBIC
)
func _to_visible(element: Control) -> void:
_transition_color(element, COLOR_VISIBLE)
func _to_disabled(element: Control) -> void:
_transition_color(element, COLOR_DISABLED)
func _to_invisible(element: Control) -> void:
_transition_color(element, COLOR_INVISIBLE)
func select_interactive(prop: Interactive) -> void:
if prop:
if prop.disabled:
_to_disabled(interact_hud)
else:
_to_visible(interact_hud)
else:
_to_invisible(interact_hud)

View File

@ -0,0 +1,47 @@
[gd_scene load_steps=3 format=3 uid="uid://dq1x21tq06dud"]
[ext_resource type="Theme" uid="uid://b07fevr214mmr" path="res://src/ui/hud/hud_theme.tres" id="1_lirk3"]
[ext_resource type="Script" path="res://src/ui/hud/player_hud.gd" id="2_j6lpx"]
[node name="PlayerHUD" type="Control"]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme = ExtResource("1_lirk3")
script = ExtResource("2_j6lpx")
[node name="InteractHUD" type="Control" parent="."]
unique_name_in_owner = true
modulate = Color(1, 1, 1, 0.866667)
custom_minimum_size = Vector2(400, 400)
layout_mode = 1
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -200.0
offset_top = -100.0
offset_right = 200.0
offset_bottom = 100.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="Label" type="Label" parent="InteractHUD"]
layout_mode = 1
anchors_preset = 7
anchor_left = 0.5
anchor_top = 1.0
anchor_right = 0.5
anchor_bottom = 1.0
offset_left = -20.0
offset_top = -23.0
offset_right = 20.0
grow_horizontal = 2
grow_vertical = 0
text = "Press [E] to use"

View File

@ -3,10 +3,11 @@ class_name GunkBody extends StaticBody3D
const CONTINUITY_LIMIT := 128
const BUFFER_LIMIT := 3
const FACE_EPSILON := 0.4
const FACE_EPSILON := 0.01
const MASK_COLOR := Color.RED
@export var mask_dim := 256
@export var mesh_instance: MeshInstance3D
var meshtool := MeshDataTool.new()
@ -19,13 +20,14 @@ var _multiline_width := 1.0
var _clear_total := 0.0
var _clear_total_dirty := true
@onready var mesh_instance: MeshInstance3D = $MeshInstance3D
@onready var mesh: ArrayMesh = mesh_instance.mesh
@onready var gunk_mat: ShaderMaterial = mesh_instance.get_surface_override_material(0).next_pass
@onready var mask_viewport: SubViewport = %MaskViewport
@onready var mask_control: DrawController = %MaskControl
@onready var debug_draw: DebugDraw = $DebugDraw
func _ready() -> void:
mask_viewport.size = Vector2(mask_dim, mask_dim)
@ -129,6 +131,8 @@ func paint_dot(point: Vector3, normal: Vector3, radius: float) -> void:
## Paint a continuous line on the gunk mask if called on successive frames.
func paint_continuous(point: Vector3, normal: Vector3, width: float) -> void:
debug_draw.draw_vector(normal, point)
var px := _get_px(point, normal)
if _polyline_buffer and px.distance_to(_polyline_buffer[0]) <= CONTINUITY_LIMIT:
_polyline_buffer.push_front(px)

View File

@ -1,7 +1,8 @@
[gd_scene load_steps=3 format=3 uid="uid://c2omlx4ptrc01"]
[gd_scene load_steps=4 format=3 uid="uid://c2omlx4ptrc01"]
[ext_resource type="Script" path="res://src/world/gunk_body/gunk_body.gd" id="1_qqbpr"]
[ext_resource type="Script" path="res://src/world/gunk_body/draw_controller.gd" id="2_kkcjw"]
[ext_resource type="Script" path="res://levels/sandbox/debug_draw.gd" id="3_m8wx4"]
[node name="GunkBody" type="StaticBody3D"]
script = ExtResource("1_qqbpr")
@ -23,4 +24,11 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2_kkcjw")
[node name="DebugDraw" type="Control" parent="."]
layout_mode = 3
anchors_preset = 0
offset_right = 40.0
offset_bottom = 40.0
script = ExtResource("3_m8wx4")
[connection signal="painted" from="MaskViewport/MaskControl" to="." method="_on_mask_painted"]