diff --git a/assets/models/bipedal_mech/animations/walk.res b/assets/models/bipedal_mech/animations/walk.res index 46e127f..9b3f7c3 100644 Binary files a/assets/models/bipedal_mech/animations/walk.res and b/assets/models/bipedal_mech/animations/walk.res differ diff --git a/assets/models/bipedal_mech/mech.gd b/assets/models/bipedal_mech/mech.gd new file mode 100644 index 0000000..55f4ab7 --- /dev/null +++ b/assets/models/bipedal_mech/mech.gd @@ -0,0 +1,11 @@ +class_name Mech +extends Node3D + +signal stomp + +@onready var animation_tree: AnimationTree = $AnimationTree + + +func _stomp() -> void: + if (animation_tree["parameters/walk_space/blend_position"] as Vector2).length() > 0.1: + stomp.emit() diff --git a/assets/models/bipedal_mech/mech.tscn b/assets/models/bipedal_mech/mech.tscn index 23e97c5..50f261f 100644 --- a/assets/models/bipedal_mech/mech.tscn +++ b/assets/models/bipedal_mech/mech.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=29 format=3 uid="uid://dd7ebaau8a70n"] +[gd_scene load_steps=30 format=3 uid="uid://dd7ebaau8a70n"] [ext_resource type="PackedScene" uid="uid://fyy7y5h5iv1g" path="res://assets/models/bipedal_mech/scene.gltf" id="1_1xwab"] [ext_resource type="Animation" uid="uid://c0h2wkp2w2akg" path="res://assets/models/bipedal_mech/animations/cockpit_open.tres" id="2_puxwb"] +[ext_resource type="Script" path="res://assets/models/bipedal_mech/mech.gd" id="2_u6cpy"] [ext_resource type="Animation" uid="uid://biapp2lcuuswt" path="res://assets/models/bipedal_mech/animations/idle.tres" id="3_1ktyh"] [ext_resource type="Animation" uid="uid://tnhy6ie7iqlq" path="res://assets/models/bipedal_mech/animations/in_air.tres" id="4_hqfkt"] [ext_resource type="Animation" uid="uid://dub06dptmcmse" path="res://assets/models/bipedal_mech/animations/jump_start.tres" id="5_46rpa"] @@ -265,6 +266,23 @@ tracks/35/path = NodePath("Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/ tracks/35/interp = 1 tracks/35/loop_wrap = true tracks/35/keys = PackedFloat32Array(0, 1, -0.000385918, -1.27161e-14, 0.000401128, 1) +tracks/36/type = "method" +tracks/36/imported = false +tracks/36/enabled = true +tracks/36/path = NodePath(".") +tracks/36/interp = 1 +tracks/36/loop_wrap = true +tracks/36/keys = { +"times": PackedFloat32Array(0.6667, 1.3333), +"transitions": PackedFloat32Array(1, 1), +"values": [{ +"args": [], +"method": &"_stomp" +}, { +"args": [], +"method": &"_stomp" +}] +} [sub_resource type="Animation" id="Animation_fgs48"] resource_name = "Armature|Walk" @@ -522,6 +540,23 @@ tracks/35/path = NodePath("Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/ tracks/35/interp = 1 tracks/35/loop_wrap = true tracks/35/keys = PackedFloat32Array(0, 1, -0.000385918, -1.27161e-14, 0.000401128, 1) +tracks/36/type = "method" +tracks/36/imported = false +tracks/36/enabled = true +tracks/36/path = NodePath(".") +tracks/36/interp = 1 +tracks/36/loop_wrap = true +tracks/36/keys = { +"times": PackedFloat32Array(0.6667, 1.3333), +"transitions": PackedFloat32Array(1, 1), +"values": [{ +"args": [], +"method": &"_stomp" +}, { +"args": [], +"method": &"_stomp" +}] +} [sub_resource type="Animation" id="Animation_dmeqn"] resource_name = "Armature|Walk" @@ -779,6 +814,23 @@ tracks/35/path = NodePath("Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/ tracks/35/interp = 1 tracks/35/loop_wrap = true tracks/35/keys = PackedFloat32Array(0, 1, -0.000385918, -1.27161e-14, 0.000401128, 1) +tracks/36/type = "method" +tracks/36/imported = false +tracks/36/enabled = true +tracks/36/path = NodePath(".") +tracks/36/interp = 1 +tracks/36/loop_wrap = true +tracks/36/keys = { +"times": PackedFloat32Array(0.6667, 1.3333), +"transitions": PackedFloat32Array(1, 1), +"values": [{ +"args": [], +"method": &"_stomp" +}, { +"args": [], +"method": &"_stomp" +}] +} [sub_resource type="AnimationLibrary" id="AnimationLibrary_pxfjg"] _data = { @@ -881,6 +933,7 @@ nodes/walk_space/position = Vector2(660, 260) node_connections = [&"air_scale", 0, &"air_anim", &"anim_state", 0, &"walk_scale", &"anim_state", 1, &"jump_state", &"jump_start_scale", 0, &"jump_start_anim", &"jump_state", 0, &"air_scale", &"jump_state", 1, &"landing_scale", &"landing_scale", 0, &"landing_anim", &"output", 0, &"anim_state", &"walk_scale", 0, &"walk_space"] [node name="Mech" instance=ExtResource("1_1xwab")] +script = ExtResource("2_u6cpy") [node name="AnimationPlayer" type="AnimationPlayer" parent="." index="0"] libraries = { @@ -903,43 +956,43 @@ parameters/walk_scale/scale = 1.0 parameters/walk_space/blend_position = Vector2(0, 0) [node name="Skeleton3D" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5" index="0"] -bones/1/position = Vector3(0, 0, 6.46634) +bones/1/position = Vector3(0, 0, 6.25956) bones/1/rotation = Quaternion(0.707107, 0, 0, 0.707107) bones/2/rotation = Quaternion(1.54543e-08, 1.54543e-08, -0.707107, 0.707107) -bones/3/rotation = Quaternion(0.655644, 0.674996, 0.235899, 0.242617) +bones/3/rotation = Quaternion(0.651302, 0.671041, 0.246924, 0.254043) bones/3/scale = Vector3(1, 1, 1) -bones/4/rotation = Quaternion(0.697912, 0.0564165, 0.0721084, 0.710307) +bones/4/rotation = Quaternion(0.732212, 0.0539352, 0.0758248, 0.67469) bones/4/scale = Vector3(1, 1, 1) -bones/5/rotation = Quaternion(-0.619592, -0.00143378, -0.101091, 0.778386) +bones/5/rotation = Quaternion(-0.648777, -0.00101797, -0.105351, 0.75365) bones/5/scale = Vector3(1, 1, 1) -bones/6/rotation = Quaternion(-0.435852, 0.0113441, -0.0629058, 0.897746) -bones/7/rotation = Quaternion(-0.839766, 0.0367104, -0.173618, 0.513129) +bones/6/rotation = Quaternion(-0.430424, 0.0118608, -0.0624292, 0.900387) +bones/7/rotation = Quaternion(-0.848977, 0.0351785, -0.176063, 0.496994) bones/7/scale = Vector3(1, 1, 1) bones/9/rotation = Quaternion(-0.577893, -0.0977404, -0.0868737, 0.805568) -bones/11/rotation = Quaternion(-0.836155, 0.0433616, -0.169046, 0.519989) +bones/11/rotation = Quaternion(-0.845569, 0.0417023, -0.171629, 0.503803) bones/11/scale = Vector3(1, 1, 1) bones/13/rotation = Quaternion(-0.583833, -0.0928994, -0.0936977, 0.80108) bones/13/scale = Vector3(1, 1, 1) bones/15/rotation = Quaternion(0.993231, -0.0067672, 0.0811647, 0.0828119) bones/15/scale = Vector3(1, 1, 1) -bones/17/rotation = Quaternion(0.751851, 0.0092213, 0.659186, 0.0104638) +bones/17/rotation = Quaternion(0.751422, 0.0195417, 0.659084, 0.0243246) bones/17/scale = Vector3(1, 1, 1) bones/19/rotation = Quaternion(-0.399104, -0.525183, -0.304683, 0.687072) bones/19/scale = Vector3(0.999999, 1, 1) bones/21/rotation = Quaternion(0.855906, -0.0322478, 0.0593455, 0.512701) -bones/23/rotation = Quaternion(0.901909, 0.00359093, 0.148827, 0.405459) +bones/23/rotation = Quaternion(0.873777, 0.00316782, 0.144331, 0.464406) bones/23/scale = Vector3(1, 1, 1) bones/25/rotation = Quaternion(-0.715396, -0.0713077, -0.0634678, 0.692168) bones/25/scale = Vector3(1, 1, 1) -bones/27/rotation = Quaternion(-0.550906, -0.00577628, -0.102558, 0.828222) +bones/27/rotation = Quaternion(-0.592901, -0.00509832, -0.108508, 0.797915) bones/29/rotation = Quaternion(0.808854, -0.0303334, 0.0651724, 0.583599) bones/31/rotation = Quaternion(0.808854, -0.0303334, 0.0651724, 0.583599) -bones/33/rotation = Quaternion(-0.54302, -0.00992266, -0.107616, 0.832736) -bones/35/rotation = Quaternion(-0.63019, 0.00362485, -0.102471, 0.769641) +bones/33/rotation = Quaternion(-0.58542, -0.00915627, -0.113493, 0.802695) +bones/35/rotation = Quaternion(-0.672817, 0.00415657, -0.108967, 0.731728) bones/35/scale = Vector3(1, 1, 1) bones/37/scale = Vector3(1, 1, 1) bones/39/scale = Vector3(1, 1, 1) -bones/41/rotation = Quaternion(-0.0147659, 0.935676, 0.352345, 0.0120526) +bones/41/rotation = Quaternion(-0.0150352, 0.940883, 0.33818, 0.0121114) bones/41/scale = Vector3(1, 1, 1) bones/43/rotation = Quaternion(-0.015884, 0.718179, -0.69565, -0.00621676) bones/43/scale = Vector3(1, 1, 1) @@ -962,37 +1015,37 @@ bones/66/rotation = Quaternion(-0.000385918, -2.26638e-14, 0.000401128, 1) bones/68/rotation = Quaternion(-0.706834, 0.000283644, -0.000283644, 0.70738) bones/70/rotation = Quaternion(-0.707107, 4.67924e-24, 4.67924e-24, 0.707107) bones/73/rotation = Quaternion(1.54543e-08, -1.54543e-08, 0.707107, 0.707107) -bones/74/rotation = Quaternion(-0.655644, 0.674996, 0.235899, -0.242617) +bones/74/rotation = Quaternion(-0.651302, 0.671041, 0.246924, -0.254043) bones/74/scale = Vector3(1, 1, 1) -bones/75/rotation = Quaternion(0.697912, -0.0564165, -0.0721084, 0.710307) +bones/75/rotation = Quaternion(0.732212, -0.0539352, -0.0758248, 0.67469) bones/75/scale = Vector3(1, 1, 1) -bones/76/rotation = Quaternion(-0.619592, 0.00143378, 0.101091, 0.778386) +bones/76/rotation = Quaternion(-0.648777, 0.00101796, 0.105351, 0.75365) bones/76/scale = Vector3(1, 1, 1) -bones/77/rotation = Quaternion(-0.435852, -0.0113441, 0.0629058, 0.897746) +bones/77/rotation = Quaternion(-0.430424, -0.0118608, 0.0624292, 0.900387) bones/77/scale = Vector3(1, 1, 1) -bones/78/rotation = Quaternion(-0.839766, -0.0367104, 0.173618, 0.513129) +bones/78/rotation = Quaternion(-0.848976, -0.0351782, 0.176064, 0.496994) bones/78/scale = Vector3(1, 1, 1) -bones/82/rotation = Quaternion(-0.836155, -0.0433616, 0.169046, 0.519989) +bones/82/rotation = Quaternion(-0.845569, -0.0417017, 0.171629, 0.503803) bones/82/scale = Vector3(1, 1, 1) bones/84/rotation = Quaternion(-0.583833, 0.0928994, 0.0936978, 0.80108) bones/86/rotation = Quaternion(0.993231, 0.0067672, -0.0811647, 0.0828119) bones/86/scale = Vector3(1, 1, 1) -bones/88/rotation = Quaternion(0.751851, -0.00922088, -0.659186, 0.0104641) +bones/88/rotation = Quaternion(0.751422, -0.019542, -0.659084, 0.0243245) bones/92/rotation = Quaternion(0.855906, 0.0322478, -0.0593455, 0.512701) bones/92/scale = Vector3(1, 1, 1) -bones/94/rotation = Quaternion(0.901909, -0.00359092, -0.148827, 0.405459) +bones/94/rotation = Quaternion(0.873777, -0.00316781, -0.144331, 0.464406) bones/94/scale = Vector3(1, 1, 1) bones/96/rotation = Quaternion(-0.715396, 0.0713076, 0.0634679, 0.692168) -bones/98/rotation = Quaternion(-0.550907, 0.00581827, 0.102585, 0.828217) +bones/98/rotation = Quaternion(-0.592901, 0.00509827, 0.108508, 0.797915) bones/100/rotation = Quaternion(0.808854, 0.0303333, -0.0651724, 0.583599) -bones/102/rotation = Quaternion(-0.543022, 0.00996488, 0.107644, 0.832731) +bones/102/rotation = Quaternion(-0.585419, 0.00915622, 0.113493, 0.802695) bones/102/scale = Vector3(1, 1, 1) bones/104/rotation = Quaternion(0.803479, 0.0249214, -0.0691385, 0.590779) -bones/106/rotation = Quaternion(-0.630191, -0.0035789, 0.102508, 0.769636) +bones/106/rotation = Quaternion(-0.672818, -0.00415663, 0.108966, 0.731728) bones/106/scale = Vector3(1, 1, 1) bones/108/scale = Vector3(1, 1, 1) bones/110/rotation = Quaternion(0.346017, 0.0755612, -0.0156624, 0.935049) -bones/112/rotation = Quaternion(0.0147659, 0.935676, 0.352345, -0.0120526) +bones/112/rotation = Quaternion(0.0150356, 0.940889, 0.338166, -0.0121113) bones/112/scale = Vector3(1, 1, 1) bones/114/rotation = Quaternion(0.015884, 0.718179, -0.69565, 0.00621692) bones/114/scale = Vector3(1, 1, 1) @@ -1008,106 +1061,106 @@ bones/126/rotation = Quaternion(0.993232, 0.00676712, -0.0811637, -0.0828125) bones/126/scale = Vector3(1, 1, 0.999988) [node name="Plane_009_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="0"] -transform = Transform3D(1, 0.000208825, -9.89214e-05, -0.000208631, 0.999999, 0.00177997, 9.9279e-05, -0.00177994, 0.999999, 0.000188351, -0.0058189, 0.000330746) +transform = Transform3D(0.999996, 0.000676498, 0.00286262, -0.000787154, 0.999246, 0.0388463, -0.00283416, -0.0388485, 0.999241, -0.0120866, -0.0283278, 0.0486985) [node name="Plane_012_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="1"] -transform = Transform3D(1, 0.000248894, -9.12547e-05, -0.00024876, 0.999998, 0.00178394, 9.16794e-05, -0.00178388, 0.999998, 0.000142336, -0.00573653, 0.00037545) +transform = Transform3D(0.999995, 0.00103264, 0.00309617, -0.00115313, 0.999232, 0.0391765, -0.0030533, -0.0391798, 0.999228, -0.0126374, -0.0282995, 0.048681) [node name="Cube_016_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="2"] -transform = Transform3D(1, 0.000167727, -7.08997e-05, -0.000167694, 1, 0.000539586, 7.09593e-05, -0.000539556, 1, 0.00020504, -0.00492105, -0.000811636) +transform = Transform3D(0.999999, -0.00030021, 0.00139831, 0.000300173, 1, 5.5626e-05, -0.00139827, -5.52088e-05, 0.999999, -0.00989199, -0.000311255, 0.00423729) [node name="Plane_004_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="3"] -transform = Transform3D(0.999996, -0.000558928, -0.00231916, 0.00056316, 0.999998, 0.00187401, 0.00231816, -0.00187538, 0.999996, 0.00346661, -0.00841075, -0.00784802) +transform = Transform3D(0.999997, -0.000482321, 0.00210897, 0.000380501, 0.998848, 0.047992, -0.00212961, -0.0479912, 0.998846, -0.00965333, -0.0524758, 0.0145226) [node name="Cube_013_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="4"] -transform = Transform3D(1, 0.000168607, -2.90573e-05, -0.000168562, 1, 0.00117546, 2.92584e-05, -0.00117546, 0.999999, 0.000189543, -0.00516421, -0.000810146) +transform = Transform3D(0.999997, -0.000310071, 0.00258977, 0.00027696, 0.999919, 0.0127915, -0.00259348, -0.0127908, 0.999915, -0.0103452, -0.00516152, 0.0054419) [node name="Plane_011_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="5"] -transform = Transform3D(1, 0.000105456, -0.00012063, -0.000105172, 0.999997, 0.00250045, 0.000120838, -0.00250048, 0.999997, 0.000742435, -0.0146177, -0.00125694) +transform = Transform3D(0.999998, -0.00153418, -0.00110752, 0.00160588, 0.997687, 0.0679595, 0.00100075, -0.0679611, 0.997688, 0.00845337, -0.405975, -0.010396) [node name="Plane_002_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="6"] -transform = Transform3D(1, 0.000279397, 4.01326e-05, -0.000279471, 0.999998, 0.00182441, -3.96147e-05, -0.00182456, 0.999998, -0.000150442, -0.00521135, 0.0010736) +transform = Transform3D(0.999995, 0.0010758, 0.00287483, -0.00119193, 0.999171, 0.0407078, -0.0028286, -0.0407111, 0.999167, -0.0132585, -0.0166031, 0.0820234) [node name="Plane_013_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="7"] -transform = Transform3D(1, 0.000279397, 4.01326e-05, -0.000279471, 0.999998, 0.00182441, -3.96147e-05, -0.00182456, 0.999998, -0.000150442, -0.00521135, 0.0010736) +transform = Transform3D(0.999995, 0.0010758, 0.00287483, -0.00119193, 0.999171, 0.0407078, -0.0028286, -0.0407111, 0.999167, -0.0132585, -0.0166031, 0.0820234) [node name="Cube_007_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="8"] -transform = Transform3D(1, 0.000249378, 4.70653e-05, -0.000249475, 0.999998, 0.002004, -4.65661e-05, -0.002004, 0.999998, -4.72069e-05, -0.00600904, -0.000368595) +transform = Transform3D(0.999997, -0.000486307, 0.00222186, 0.000371352, 0.998675, 0.0514536, -0.00224388, -0.0514526, 0.998673, -0.00980353, -0.0560383, 0.0175886) [node name="Plane_015_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="9"] -transform = Transform3D(1, 0.000131764, 1.88351e-05, -0.000131741, 1, -0.000544041, -1.89021e-05, 0.000543863, 1, 0.000100613, -0.000808299, -0.00234747) +transform = Transform3D(0.999994, -0.000135668, 0.00343373, 0.000361606, 0.997828, -0.0658715, -0.00341727, 0.0658723, 0.997822, -0.0127041, 0.201238, -0.0637798) [node name="Cube_010_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="10"] -transform = Transform3D(1, 1.79391e-05, -2.70499e-05, -1.78665e-05, 0.999997, 0.00247942, 2.71081e-05, -0.00247944, 0.999997, 0.000164509, -0.0151605, -0.00416899) +transform = Transform3D(1, -8.38228e-05, -0.000872246, 0.000141652, 0.997789, 0.066468, 0.000864799, -0.0664681, 0.997788, 0.00560045, -0.399766, -0.158443) [node name="Cube_012_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="11"] -transform = Transform3D(1, 5.62271e-06, -2.91198e-05, -5.57129e-06, 0.999999, 0.00162446, 2.91389e-05, -0.00162441, 0.999999, 0.000183344, -0.0104586, -0.00458622) +transform = Transform3D(1, -0.000322304, -0.000670722, 0.000345937, 0.999371, 0.0354678, 0.000658918, -0.035468, 0.999371, 0.00459433, -0.229222, -0.181004) [node name="Cylinder_002_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="12"] -transform = Transform3D(1, -1.77636e-15, 0, -1.77636e-15, 1, -4.37113e-08, 0, 4.37113e-08, 1, 0, 0, -0.0058589) +transform = Transform3D(1, -1.77636e-15, 0, -1.77636e-15, 1, -4.37113e-08, 0, 4.37113e-08, 1, 0, 0, -0.212643) [node name="Cube_006_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="13"] -transform = Transform3D(1, 7.18785e-10, -2.03527e-08, -7.31035e-10, 1, -1.49128e-07, 2.02767e-08, 1.78756e-07, 1, -1.19209e-07, -1.43051e-06, -0.00585842) +transform = Transform3D(1, 7.18899e-10, -2.01781e-08, -7.60139e-10, 1, -1.49128e-07, 2.01603e-08, 1.78756e-07, 1, -1.19209e-07, -1.43051e-06, -0.212644) [node name="Cube_017_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="14"] -transform = Transform3D(1, 3.1531e-10, 2.16907e-08, -3.26025e-10, 1, -1.19326e-07, -2.17319e-08, 1.78814e-07, 1, 1.19209e-07, -1.90735e-06, -0.00586033) +transform = Transform3D(1, 3.15225e-10, 2.16325e-08, -3.11474e-10, 1, -1.19326e-07, -2.16737e-08, 1.78814e-07, 1, 1.19209e-07, -1.90735e-06, -0.212645) [node name="Cube_005_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="15"] -transform = Transform3D(1, -1.42109e-13, -3.41061e-13, 2.27374e-13, 1, -9.23872e-07, 3.97904e-13, 9.23872e-07, 1, -9.09153e-13, 4.52995e-06, -0.00586033) +transform = Transform3D(1, -1.7053e-13, -3.41061e-13, 2.84217e-13, 1, -9.23872e-07, 3.41061e-13, 9.23872e-07, 1, -9.09153e-13, 4.52995e-06, -0.212645) [node name="Cube_005_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D/Cube_005_Material_0" index="0"] surface_material_override/0 = ExtResource("8_dt6e4") [node name="Cube_005_Inside_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="16"] -transform = Transform3D(1, -1.42109e-13, -3.41061e-13, 2.27374e-13, 1, -9.23872e-07, 3.97904e-13, 9.23872e-07, 1, -9.09153e-13, 4.52995e-06, -0.00586033) +transform = Transform3D(1, -1.7053e-13, -3.41061e-13, 2.84217e-13, 1, -9.23872e-07, 3.41061e-13, 9.23872e-07, 1, -9.09153e-13, 4.52995e-06, -0.212645) [node name="Plane_003_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="17"] -transform = Transform3D(1, 1.0877e-10, -1.02383e-08, -1.10134e-10, 1, -2.82831e-07, 1.02508e-08, 2.82773e-07, 1, -2.38419e-07, 0, -0.00585938) +transform = Transform3D(1, 1.08827e-10, -1.00637e-08, -1.10077e-10, 1, -2.82656e-07, 1.00761e-08, 2.82598e-07, 1, -2.38419e-07, 0, -0.212643) [node name="Plane_016_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="18"] -transform = Transform3D(1, -1.0877e-10, 1.02383e-08, 1.10134e-10, 1, -2.82831e-07, -1.02508e-08, 2.82773e-07, 1, 2.38419e-07, 0, -0.00585938) +transform = Transform3D(1, -1.08827e-10, 1.00637e-08, 1.10077e-10, 1, -2.82656e-07, -1.00761e-08, 2.82598e-07, 1, 2.38419e-07, 0, -0.212643) [node name="Cube_008_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="19"] -transform = Transform3D(1, -2.64698e-23, 9.95068e-31, 2.64698e-23, 1, 0, -9.95068e-31, 0, 1, -1.90621e-29, 0, -0.0058589) +transform = Transform3D(1, -2.64698e-23, 9.95068e-31, 2.64698e-23, 1, 0, -9.95068e-31, 0, 1, -1.90621e-29, 0, -0.212643) [node name="Cube_008_Inside_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="20"] -transform = Transform3D(1, -2.64698e-23, 9.95068e-31, 2.64698e-23, 1, 0, -9.95068e-31, 0, 1, -1.90621e-29, 0, -0.0058589) +transform = Transform3D(1, -2.64698e-23, 9.95068e-31, 2.64698e-23, 1, 0, -9.95068e-31, 0, 1, -1.90621e-29, 0, -0.212643) [node name="Plane_006_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="21"] -transform = Transform3D(1, -0.000209004, 9.89735e-05, 0.00020878, 1, 0.00178105, -9.9346e-05, -0.00178099, 0.999999, -0.00018692, -0.00581878, 0.000331163) +transform = Transform3D(0.999996, -0.000676036, -0.00286453, 0.000786722, 0.999246, 0.0388484, 0.00283602, -0.0388503, 0.999241, 0.0120888, -0.02833, 0.0487061) [node name="Plane_008_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="22"] -transform = Transform3D(1, -0.000249088, 9.11504e-05, 0.000248939, 1, 0.00178403, -9.15751e-05, -0.00178391, 0.999999, -0.000141382, -0.00573641, 0.00037539) +transform = Transform3D(0.999995, -0.00103359, -0.00309755, 0.00115408, 0.999233, 0.0391774, 0.00305459, -0.0391807, 0.999228, 0.01264, -0.0282973, 0.0486844) [node name="Cube_004_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="23"] -transform = Transform3D(1, -0.000167731, 7.09146e-05, 0.000167692, 1, 0.000539586, -7.09742e-05, -0.000539526, 1, -0.000205517, -0.00492115, -0.000811875) +transform = Transform3D(0.999999, 0.000300003, -0.00139847, -0.000299988, 1, 5.64307e-05, 0.00139841, -5.58496e-05, 0.999999, 0.00989199, -0.000310972, 0.00423768) [node name="Plane_005_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="24"] -transform = Transform3D(0.999997, 0.000559106, 0.00232062, -0.000562951, 0.999998, 0.00187385, -0.00231987, -0.0018753, 0.999995, -0.00346375, -0.00841123, -0.00785065) +transform = Transform3D(0.999998, 0.000481904, -0.00210907, -0.000379503, 0.998848, 0.047992, 0.00212923, -0.0479911, 0.998846, 0.00965858, -0.0524739, 0.0145243) [node name="Cube_003_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="25"] -transform = Transform3D(1, -0.000168614, 2.90573e-05, 0.000168569, 0.999999, 0.00117546, -2.9251e-05, -0.00117546, 0.999999, -0.00019002, -0.00516403, -0.000810385) +transform = Transform3D(0.999997, 0.000310034, -0.00258979, -0.000276968, 0.999918, 0.0127916, 0.00259348, -0.0127907, 0.999915, 0.0103447, -0.00516117, 0.00544214) [node name="Plane_007_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="26"] -transform = Transform3D(1, -0.000105456, 0.00012036, 0.000105187, 0.999997, 0.00250039, -0.000120599, -0.00250048, 0.999997, -0.000739813, -0.0146175, -0.00125599) +transform = Transform3D(0.999998, 0.00153416, 0.00110728, -0.00160593, 0.997687, 0.0679595, -0.00100052, -0.0679611, 0.997688, -0.00845122, -0.405975, -0.0103951) [node name="Plane_014_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="27"] -transform = Transform3D(1, -0.000212938, 3.3699e-05, 0.000212878, 0.999998, 0.00183728, -3.40603e-05, -0.00183749, 0.999998, -9.60827e-05, -0.0054698, 0.000836134) +transform = Transform3D(0.999995, -0.00107604, -0.00287502, 0.00119212, 0.999171, 0.0407079, 0.00282877, -0.0407111, 0.999167, 0.0132596, -0.0166022, 0.0820253) [node name="Plane_010_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="28"] -transform = Transform3D(1, -0.00022693, 2.88337e-05, 0.00022684, 0.999999, 0.00184411, -2.92473e-05, -0.00184414, 0.999999, -6.84261e-05, -0.00551021, 0.00084281) +transform = Transform3D(0.999994, -0.00190684, -0.00299408, 0.00202805, 0.999156, 0.0410292, 0.00291327, -0.0410351, 0.999154, 0.0146291, -0.0163962, 0.0808012) [node name="Cube_014_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="29"] -transform = Transform3D(1, -0.000171416, 4.05163e-05, 0.000171341, 0.999998, 0.00201902, -4.08739e-05, -0.00201914, 0.999998, -0.000202179, -0.00628805, -0.000633478) +transform = Transform3D(0.999997, 0.000486463, -0.00222396, -0.000371471, 0.998675, 0.0514538, 0.00224598, -0.0514528, 0.998673, 0.00980759, -0.0560388, 0.0175948) [node name="Plane_001_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="30"] -transform = Transform3D(1, -0.000131771, -1.86861e-05, 0.000131756, 1, -0.00054419, 1.8768e-05, 0.000544071, 1, -0.000100851, -0.000807941, -0.00234795) +transform = Transform3D(0.999994, 0.000135668, -0.00343358, -0.000361614, 0.997828, -0.0658717, 0.00341713, 0.0658726, 0.997822, 0.0127041, 0.201239, -0.0637798) [node name="Cube_015_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="31"] -transform = Transform3D(1, -1.81627e-05, 2.68199e-05, 1.80881e-05, 0.999997, 0.00247942, -2.68787e-05, -0.00247945, 0.999997, -0.000163078, -0.0151599, -0.00416851) +transform = Transform3D(1, 8.30274e-05, 0.000871937, -0.000140907, 0.997787, 0.0664992, -0.000864538, -0.0664994, 0.997786, -0.00559831, -0.399936, -0.158416) [node name="Cube_001_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="32"] -transform = Transform3D(1, -5.63203e-06, 2.91384e-05, 5.58006e-06, 0.999999, 0.00162446, -2.91583e-05, -0.00162441, 0.999999, -0.000183821, -0.0104582, -0.00458622) +transform = Transform3D(1, 0.000322295, 0.000670741, -0.000345959, 0.999371, 0.0354678, -0.000658938, -0.0354679, 0.999371, -0.0045948, -0.229222, -0.181005) [node name="Cylinder_001_Material_0" parent="Sketchfab_model/bed584e06fe94e71a7ac484cee9f0a16_fbx/Object_2/RootNode/Armature/Object_5/Skeleton3D" index="33"] -transform = Transform3D(1, 1.77636e-15, 0, 1.77636e-15, 1, -4.37113e-08, 0, 4.37113e-08, 1, 0, 0, -0.0058589) +transform = Transform3D(1, 1.77636e-15, 0, 1.77636e-15, 1, -4.37113e-08, 0, 4.37113e-08, 1, 0, 0, -0.212643) diff --git a/assets/textures/crosshair.xcf b/assets/textures/crosshair.xcf new file mode 100644 index 0000000..73e6ce5 Binary files /dev/null and b/assets/textures/crosshair.xcf differ diff --git a/assets/textures/crosshair_circle.png b/assets/textures/crosshair_circle.png new file mode 100644 index 0000000..982f57e --- /dev/null +++ b/assets/textures/crosshair_circle.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2dbb4fe9cd2133bdb02df4518635660621ebbb41428ce44fdc41edf029663eee +size 689 diff --git a/assets/textures/crosshair_circle.png.import b/assets/textures/crosshair_circle.png.import new file mode 100644 index 0000000..67333e5 --- /dev/null +++ b/assets/textures/crosshair_circle.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://bepxfquua1v6" +path="res://.godot/imported/crosshair_circle.png-2b866d6d4df17d3d24ef4b12db7ff9e0.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/crosshair_circle.png" +dest_files=["res://.godot/imported/crosshair_circle.png-2b866d6d4df17d3d24ef4b12db7ff9e0.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=false +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=1 diff --git a/assets/textures/crosshair_dot.png b/assets/textures/crosshair_dot.png new file mode 100644 index 0000000..fc14680 --- /dev/null +++ b/assets/textures/crosshair_dot.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a1931f7aae1aab329cf715517138724191dcbd45517406039a0bb675e20a25b9 +size 597 diff --git a/assets/textures/crosshair_dot.png.import b/assets/textures/crosshair_dot.png.import new file mode 100644 index 0000000..cb556ff --- /dev/null +++ b/assets/textures/crosshair_dot.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://hmt7s15m7eto" +path="res://.godot/imported/crosshair_dot.png-02030b5dd1738bacd56dd6f6a7f06789.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://assets/textures/crosshair_dot.png" +dest_files=["res://.godot/imported/crosshair_dot.png-02030b5dd1738bacd56dd6f6a7f06789.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=false +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=1 diff --git a/src/crosshair.gd b/src/crosshair.gd new file mode 100644 index 0000000..0acb1d9 --- /dev/null +++ b/src/crosshair.gd @@ -0,0 +1,17 @@ +class_name Crosshair +extends CenterContainer + +const CROSSHAIR_RETURN_SPEED = 30 + +@onready var crosshair_circle: TextureRect = $CrosshairContainer/CrosshairCircle +@onready var crosshair_dot: TextureRect = $CrosshairContainer/CrosshairDot + + +func jostle(delta: Vector2) -> void: + crosshair_circle.position += delta + + +func _process(delta: float) -> void: + crosshair_circle.position = crosshair_circle.position.lerp( + Vector2.ZERO, delta * CROSSHAIR_RETURN_SPEED + ) diff --git a/src/main.tscn b/src/main.tscn index 4bb8df4..fd422cb 100644 --- a/src/main.tscn +++ b/src/main.tscn @@ -1,7 +1,17 @@ -[gd_scene load_steps=4 format=3 uid="uid://d75odchj18u1"] +[gd_scene load_steps=10 format=3 uid="uid://d75odchj18u1"] +[ext_resource type="Script" path="res://src/crosshair.gd" id="1_8vuwf"] [ext_resource type="Shader" path="res://src/shaders/threshold.gdshader" id="1_bg1gg"] [ext_resource type="PackedScene" uid="uid://drbiyuustse8b" path="res://src/maps/arena_map/arena_map.tscn" id="1_bvhtq"] +[ext_resource type="Shader" path="res://src/shaders/invert.gdshader" id="1_rg2hr"] +[ext_resource type="Texture2D" uid="uid://bepxfquua1v6" path="res://assets/textures/crosshair_circle.png" id="3_1ycfj"] +[ext_resource type="Texture2D" uid="uid://hmt7s15m7eto" path="res://assets/textures/crosshair_dot.png" id="3_3u7nt"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_ag8l2"] +shader = ExtResource("1_rg2hr") + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_csvvm"] +shader = ExtResource("1_rg2hr") [sub_resource type="ShaderMaterial" id="ShaderMaterial_ubp15"] shader = ExtResource("1_bg1gg") @@ -11,10 +21,40 @@ shader_parameter/threshold = 0.506 shader_parameter/contrast = 1.0 shader_parameter/offset = 0.0 -[node name="Main" type="Node3D"] +[node name="Main" type="Control"] +custom_minimum_size = Vector2(1900, 768) +layout_mode = 3 +anchors_preset = 0 + +[node name="Crosshair" type="CenterContainer" parent="." groups=["CrosshairGroup"]] +z_index = 1 +layout_mode = 0 +offset_right = 1900.0 +offset_bottom = 768.0 +script = ExtResource("1_8vuwf") + +[node name="CrosshairContainer" type="Control" parent="Crosshair"] +custom_minimum_size = Vector2(32, 32) +layout_mode = 2 + +[node name="CrosshairCircle" type="TextureRect" parent="Crosshair/CrosshairContainer"] +material = SubResource("ShaderMaterial_ag8l2") +layout_mode = 2 +offset_right = 32.0 +offset_bottom = 32.0 +texture = ExtResource("3_1ycfj") +stretch_mode = 2 + +[node name="CrosshairDot" type="TextureRect" parent="Crosshair/CrosshairContainer"] +material = SubResource("ShaderMaterial_csvvm") +layout_mode = 2 +offset_right = 32.0 +offset_bottom = 32.0 +texture = ExtResource("3_3u7nt") [node name="ViewportContainer" type="SubViewportContainer" parent="."] material = SubResource("ShaderMaterial_ubp15") +layout_mode = 0 offset_right = 1900.0 offset_bottom = 768.0 stretch = true diff --git a/src/player/player.gd b/src/player/player.gd index 03a43d3..577ef5e 100644 --- a/src/player/player.gd +++ b/src/player/player.gd @@ -11,10 +11,12 @@ const TURN_SENSITIVITY: float = 0.04 # Get the gravity from the project settings to be synced with RigidBody nodes. var gravity: float = ProjectSettings.get_setting("physics/3d/default_gravity") -@onready var camera_root: Node3D = $CameraRoot +@onready var camera_root: ThirdPersonCamera = $CameraRoot @onready var mesh: Node3D = $Mesh @onready var animation_tree: AnimationTree = $Mesh/Mech/AnimationTree +@onready var _crosshair: Crosshair = get_tree().get_first_node_in_group("CrosshairGroup") + func _physics_process(delta: float) -> void: var delta_factor: float = delta * TARGET_FPS @@ -61,3 +63,8 @@ func _physics_process(delta: float) -> void: velocity.z = lerpf(velocity.z, 0.0, delta_factor * drag) move_and_slide() + + +func _on_mech_stomp() -> void: + _crosshair.jostle(Vector2(randf_range(-5, 5), randf_range(-15, 5))) + # camera_root.jostle(randf_range(-2, 2)) diff --git a/src/player/player.tscn b/src/player/player.tscn index 7241f8d..e9e65a1 100644 --- a/src/player/player.tscn +++ b/src/player/player.tscn @@ -30,3 +30,5 @@ spring_length = -1.5 [node name="Camera3D" type="Camera3D" parent="CameraRoot/SpringArm3D"] transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, -1.5) current = true + +[connection signal="stomp" from="Mesh/Mech" to="." method="_on_mech_stomp"] diff --git a/src/player/third_person_camera.gd b/src/player/third_person_camera.gd index 2b0c904..c3c68dd 100644 --- a/src/player/third_person_camera.gd +++ b/src/player/third_person_camera.gd @@ -1,5 +1,8 @@ +class_name ThirdPersonCamera extends Node3D +const CROSSHAIR_MOUSE_JOSTLE: float = 0.6 +const CORRECTION_SPEED: float = 10 @export var yaw_sensitivity: float = 0.4 @export var yaw_acceleration: float = 20.0 @@ -12,15 +15,31 @@ extends Node3D @onready var _target: Vector2 = Vector2(global_rotation_degrees.x, rotation_degrees.y) +@onready var _crosshair: Crosshair = get_tree().get_first_node_in_group("CrosshairGroup") + + func _ready() -> void: Input.mouse_mode = Input.MOUSE_MODE_CAPTURED + +func jostle(delta: float) -> void: + rotation_degrees.z += delta + + func _unhandled_input(event: InputEvent) -> void: if event is InputEventMouseMotion: var motion: Vector2 = (event as InputEventMouseMotion).relative _target.y = _target.y - motion.x * yaw_sensitivity - _target.x = clampf(_target.x + motion.y * pitch_sensitivity * (-1 if invert_pitch else 1), pitch_min, pitch_max) + _target.x = clampf( + _target.x + motion.y * pitch_sensitivity * (-1 if invert_pitch else 1), + pitch_min, + pitch_max + ) + _crosshair.jostle(motion * CROSSHAIR_MOUSE_JOSTLE) + func _physics_process(delta: float) -> void: rotation_degrees.y = lerpf(rotation_degrees.y, _target.y, delta * yaw_acceleration) rotation_degrees.x = lerpf(rotation_degrees.x, _target.x, delta * pitch_acceleration) + + rotation_degrees.z = lerpf(rotation_degrees.z, 0.0, delta * CORRECTION_SPEED) diff --git a/src/shaders/invert.gdshader b/src/shaders/invert.gdshader new file mode 100644 index 0000000..dd21425 --- /dev/null +++ b/src/shaders/invert.gdshader @@ -0,0 +1,9 @@ +shader_type canvas_item; + +uniform sampler2D screen_texture: hint_screen_texture; + +void fragment() { + vec4 color = vec4(texture(screen_texture, SCREEN_UV).rgb, texture(TEXTURE, UV).a); + + COLOR = vec4(1.0 - color.rgb, color.a); +} \ No newline at end of file