From 2670392e2de33696f2176730f2c6471173128a9f Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 20 Feb 2026 13:48:02 -0600 Subject: [PATCH] Added animation tree to player model --- game/scenes/Levels/level.tscn | 290 ++++++++++++++++++++-------------- 1 file changed, 170 insertions(+), 120 deletions(-) diff --git a/game/scenes/Levels/level.tscn b/game/scenes/Levels/level.tscn index 4dfcbbc..972983e 100644 --- a/game/scenes/Levels/level.tscn +++ b/game/scenes/Levels/level.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=23 format=3 uid="uid://dchj6g2i8ebph"] +[gd_scene load_steps=61 format=3 uid="uid://dchj6g2i8ebph"] [ext_resource type="Script" uid="uid://brgmxhhhtakja" path="res://scenes/Levels/level.gd" id="1_a4mo8"] [ext_resource type="PackedScene" uid="uid://bb6hj6l23043x" path="res://assets/models/human.blend" id="1_eg4yq"] @@ -22,6 +22,170 @@ bounce = 0.5 [sub_resource type="SphereShape3D" id="SphereShape3D_mx8sn"] +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_he7fi"] +animation = &"Idle" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_42npc"] +animation = &"Idle" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_neck2"] +animation = &"Idle" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_bg4jh"] +animation = &"Idle" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_43ksg"] +animation = &"Jump" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_loupo"] +animation = &"Jump" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1meta"] +animation = &"LStrafe" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_i35yb"] +animation = &"LStrafeWalk" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_18iqp"] +animation = &"LTurn" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_px5jg"] +animation = &"LTurn90" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_f2oql"] +animation = &"RStrafe" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8hdhy"] +animation = &"RStrafe" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8ydj0"] +animation = &"RStrafeWalk" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ol8dr"] +animation = &"RTurn" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_eorea"] +animation = &"RTurn90" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_mwo3k"] +animation = &"Run" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_j43p6"] +animation = &"Run" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7qd4n"] +animation = &"Walk" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_5wdrc"] +animation = &"Walk" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_k13o0"] +animation = &"Walk" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_pqisa"] +animation = &"Walk" + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_5qdlo"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hwpvo"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_2jvac"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m443h"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ccri0"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_aqwus"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_tknc3"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ygago"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_koxac"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0pp6t"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3xa5y"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8m234"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jnqa2"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_vwq6c"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e2sp2"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_r45s2"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p7els"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_elh2a"] +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_bwsrl"] +states/End/position = Vector2(664, 130) +states/Idle/node = SubResource("AnimationNodeAnimation_bg4jh") +states/Idle/position = Vector2(318, 57) +"states/Idle 2/node" = SubResource("AnimationNodeAnimation_he7fi") +"states/Idle 2/position" = Vector2(397, 105) +"states/Idle 3/node" = SubResource("AnimationNodeAnimation_42npc") +"states/Idle 3/position" = Vector2(312, 279) +"states/Idle 4/node" = SubResource("AnimationNodeAnimation_neck2") +"states/Idle 4/position" = Vector2(437, 356) +states/Jump/node = SubResource("AnimationNodeAnimation_loupo") +states/Jump/position = Vector2(282, 356) +"states/Jump 2/node" = SubResource("AnimationNodeAnimation_43ksg") +"states/Jump 2/position" = Vector2(421, 287) +states/LStrafe/node = SubResource("AnimationNodeAnimation_1meta") +states/LStrafe/position = Vector2(1401, 100) +states/LStrafeWalk/node = SubResource("AnimationNodeAnimation_i35yb") +states/LStrafeWalk/position = Vector2(1346, 175) +states/LTurn/node = SubResource("AnimationNodeAnimation_18iqp") +states/LTurn/position = Vector2(1516, 83) +states/LTurn90/node = SubResource("AnimationNodeAnimation_px5jg") +states/LTurn90/position = Vector2(1550, 208) +states/RStrafe/node = SubResource("AnimationNodeAnimation_8hdhy") +states/RStrafe/position = Vector2(856, 161) +"states/RStrafe 2/node" = SubResource("AnimationNodeAnimation_f2oql") +"states/RStrafe 2/position" = Vector2(956, 208) +states/RStrafeWalk/node = SubResource("AnimationNodeAnimation_8ydj0") +states/RStrafeWalk/position = Vector2(1181, 155) +states/RTurn/node = SubResource("AnimationNodeAnimation_ol8dr") +states/RTurn/position = Vector2(1065, 162) +states/RTurn90/node = SubResource("AnimationNodeAnimation_eorea") +states/RTurn90/position = Vector2(1218, 92) +states/Run/node = SubResource("AnimationNodeAnimation_j43p6") +states/Run/position = Vector2(293, 225) +"states/Run 2/node" = SubResource("AnimationNodeAnimation_mwo3k") +"states/Run 2/position" = Vector2(421, 161) +states/Start/position = Vector2(156, 121) +states/Walk/node = SubResource("AnimationNodeAnimation_pqisa") +states/Walk/position = Vector2(414, 57) +"states/Walk 2/node" = SubResource("AnimationNodeAnimation_7qd4n") +"states/Walk 2/position" = Vector2(303, 111) +"states/Walk 3/node" = SubResource("AnimationNodeAnimation_5wdrc") +"states/Walk 3/position" = Vector2(312, 175) +"states/Walk 4/node" = SubResource("AnimationNodeAnimation_k13o0") +"states/Walk 4/position" = Vector2(421, 219) +transitions = ["Idle", "Walk", SubResource("AnimationNodeStateMachineTransition_5qdlo"), "Walk 2", "Idle 2", SubResource("AnimationNodeStateMachineTransition_hwpvo"), "Walk 3", "Run 2", SubResource("AnimationNodeStateMachineTransition_2jvac"), "Run", "Walk 4", SubResource("AnimationNodeStateMachineTransition_m443h"), "Start", "Idle", SubResource("AnimationNodeStateMachineTransition_ccri0"), "Start", "Walk 2", SubResource("AnimationNodeStateMachineTransition_aqwus"), "Start", "Walk 3", SubResource("AnimationNodeStateMachineTransition_tknc3"), "Start", "Run", SubResource("AnimationNodeStateMachineTransition_ygago"), "Idle 3", "Jump 2", SubResource("AnimationNodeStateMachineTransition_koxac"), "Jump", "Idle 4", SubResource("AnimationNodeStateMachineTransition_0pp6t"), "Start", "Jump", SubResource("AnimationNodeStateMachineTransition_3xa5y"), "Start", "Idle 3", SubResource("AnimationNodeStateMachineTransition_8m234"), "Walk", "End", SubResource("AnimationNodeStateMachineTransition_jnqa2"), "Idle 2", "End", SubResource("AnimationNodeStateMachineTransition_vwq6c"), "Run 2", "End", SubResource("AnimationNodeStateMachineTransition_e2sp2"), "Walk 4", "End", SubResource("AnimationNodeStateMachineTransition_r45s2"), "Jump 2", "End", SubResource("AnimationNodeStateMachineTransition_p7els"), "Idle 4", "End", SubResource("AnimationNodeStateMachineTransition_elh2a")] + [sub_resource type="SphereShape3D" id="SphereShape3D_dialog_zone"] radius = 2.5 @@ -78,125 +242,6 @@ phone_path = NodePath("../PhoneUI") [node name="TestCharAnimated" parent="Player" instance=ExtResource("5_fi66n")] transform = Transform3D(-0.9998549, 0, 0.01703362, 0, 1, 0, -0.01703362, 0, -0.9998549, 0, 0, 0) -[node name="Skeleton3D" parent="Player/TestCharAnimated/Armature" index="0"] -bones/0/position = Vector3(0.002616825, -0.0012634661, -0.98995954) -bones/0/rotation = Quaternion(-0.7278332, -0.05342924, 0.012382713, 0.6835575) -bones/1/position = Vector3(8.593209e-06, 0.09923458, -0.012273359) -bones/1/rotation = Quaternion(-0.03163086, 0.011397719, 0.022761386, 0.9991754) -bones/2/position = Vector3(-2.2989244e-10, 0.117319785, 2.9730852e-08) -bones/2/rotation = Quaternion(0.0102874795, 0.0011603195, 0.013812066, 0.99985105) -bones/3/position = Vector3(-2.3358266e-09, 0.13458829, -1.382244e-08) -bones/3/rotation = Quaternion(0.06755522, 0.0021543663, 0.013774819, 0.99761814) -bones/4/position = Vector3(2.508626e-07, 0.15027755, 0.008779066) -bones/4/rotation = Quaternion(0.051899955, -0.00089839776, 0.0039267424, 0.9986442) -bones/5/position = Vector3(2.152588e-08, 0.103218146, 0.03142428) -bones/5/rotation = Quaternion(-0.06595736, 0.011938445, -0.0014933152, 0.9977499) -bones/6/position = Vector3(1.5477327e-06, 0.18474667, 0.06636399) -bones/7/position = Vector3(0.061058242, 0.09106279, 0.0075706206) -bones/7/rotation = Quaternion(-0.598225, -0.43451372, 0.5076822, -0.44224826) -bones/8/position = Vector3(1.1842036e-08, 0.12922287, 5.2578955e-08) -bones/8/rotation = Quaternion(0.543452, 0.18399428, 0.20302251, 0.79346573) -bones/9/position = Vector3(1.5054144e-07, 0.2740467, 2.2048344e-08) -bones/9/rotation = Quaternion(-5.2907154e-09, -1.1239725e-06, 0.012734968, 0.999919) -bones/10/position = Vector3(1.9432857e-08, 0.27614468, 9.6609995e-08) -bones/10/rotation = Quaternion(0.04830448, -0.2848921, 0.026799988, 0.9569665) -bones/11/position = Vector3(-0.030029751, 0.037888147, 0.021671427) -bones/11/rotation = Quaternion(0.2098604, -0.059559863, 0.20750383, 0.9536002) -bones/12/position = Vector3(-3.3527822e-08, 0.0474497, -1.48403245e-08) -bones/12/rotation = Quaternion(-0.14269812, 0.08661232, -0.24053419, 0.9561793) -bones/13/position = Vector3(-9.313215e-09, 0.043821093, 1.7813335e-08) -bones/13/rotation = Quaternion(-0.121022485, -0.07554186, 0.024044419, 0.98947906) -bones/14/position = Vector3(-4.847594e-08, 0.034590863, -5.3379924e-08) -bones/15/position = Vector3(-0.02822038, 0.12266627, 0.0023182186) -bones/15/rotation = Quaternion(0.06621808, 0.00073213095, 0.008435749, 0.99776924) -bones/16/position = Vector3(-8.136956e-09, 0.03891963, -1.4837047e-08) -bones/16/rotation = Quaternion(0.1509963, 7.805282e-07, -0.015479834, 0.98841316) -bones/17/position = Vector3(7.499967e-09, 0.034151517, -5.4443618e-08) -bones/17/rotation = Quaternion(0.070082076, 7.71772e-07, -0.007181638, 0.99751544) -bones/18/position = Vector3(2.700483e-09, 0.030779874, 4.9589467e-08) -bones/19/position = Vector3(-1.2452401e-07, 0.12775533, -8.01722e-08) -bones/19/rotation = Quaternion(0.13653132, -0.0038339633, -0.022952663, 0.9903624) -bones/20/position = Vector3(2.5990463e-09, 0.036139663, 1.713758e-10) -bones/20/rotation = Quaternion(0.15125485, 1.1823237e-06, -0.015500045, 0.9883733) -bones/21/position = Vector3(2.9034163e-07, 0.034597658, -3.6051716e-08) -bones/21/rotation = Quaternion(0.1599333, 1.4124467e-06, -0.016389191, 0.98699176) -bones/22/position = Vector3(-3.0519334e-07, 0.03680197, -9.1170705e-08) -bones/23/position = Vector3(0.022166358, 0.12147022, -9.993157e-05) -bones/23/rotation = Quaternion(0.18325116, -0.004651328, -0.031451236, 0.9825519) -bones/24/position = Vector3(4.5585904e-09, 0.036011815, -8.07135e-09) -bones/24/rotation = Quaternion(0.18138836, 1.5675009e-06, -0.018595627, 0.9832358) -bones/25/position = Vector3(-9.647604e-09, 0.033073086, -1.46341534e-08) -bones/25/rotation = Quaternion(0.1552087, 2.2643005e-06, -0.015905593, 0.9877537) -bones/26/position = Vector3(-2.434721e-07, 0.03660111, 2.471306e-07) -bones/27/position = Vector3(0.04725836, 0.109081924, 0.0022613404) -bones/27/rotation = Quaternion(0.23387046, -0.0035344863, -0.048872076, 0.97103226) -bones/28/position = Vector3(4.3135207e-09, 0.041366525, 3.569472e-08) -bones/28/rotation = Quaternion(0.15124865, 1.4340599e-05, -0.015863812, 0.98836845) -bones/29/position = Vector3(1.195453e-08, 0.02594832, 1.5542597e-08) -bones/29/rotation = Quaternion(0.14350323, 3.322942e-05, -0.014478063, 0.98954403) -bones/30/position = Vector3(-2.4944999e-08, 0.029238665, 6.2325825e-08) -bones/31/position = Vector3(-0.06105696, 0.09106397, 0.007570758) -bones/31/rotation = Quaternion(0.60012215, -0.43466684, 0.5242142, 0.41966385) -bones/32/position = Vector3(2.116817e-08, 0.12922288, 7.016769e-08) -bones/32/rotation = Quaternion(0.46436408, -0.26298717, -0.23268588, 0.8130566) -bones/33/position = Vector3(-2.350565e-08, 0.27404687, 1.5161348e-08) -bones/33/rotation = Quaternion(7.69042e-08, -5.0622584e-06, -0.058380682, 0.9982944) -bones/34/position = Vector3(1.3629875e-07, 0.27614468, -9.158248e-09) -bones/34/rotation = Quaternion(0.059025347, 0.17513894, -0.005969527, 0.9827547) -bones/35/position = Vector3(0.030029776, 0.03788806, 0.021671649) -bones/35/rotation = Quaternion(0.21378386, 0.065372065, -0.22564878, 0.94821185) -bones/36/position = Vector3(-2.7939748e-09, 0.04744962, -1.7240383e-08) -bones/36/rotation = Quaternion(-0.14410053, -0.076146945, 0.2772088, 0.9468854) -bones/37/position = Vector3(5.58785e-09, 0.04382136, 3.566345e-08) -bones/37/rotation = Quaternion(-0.1552004, 0.07467698, -0.026057797, 0.9847117) -bones/38/position = Vector3(8.2187e-08, 0.034590647, -2.4929412e-07) -bones/39/position = Vector3(0.028220426, 0.1226661, 0.0023184721) -bones/39/rotation = Quaternion(0.059513006, -0.0009918809, -0.010980465, 0.99816674) -bones/40/position = Vector3(-1.1795999e-08, 0.038919587, -4.9162594e-09) -bones/40/rotation = Quaternion(0.15128906, 2.1640317e-06, 0.012328284, 0.98841274) -bones/41/position = Vector3(-1.4053852e-07, 0.034151636, -1.1118345e-08) -bones/41/rotation = Quaternion(0.07021882, 5.966413e-07, 0.0057199914, 0.9975152) -bones/42/position = Vector3(-7.1266735e-09, 0.030779934, 3.7720538e-10) -bones/43/position = Vector3(1.69263e-07, 0.12775521, 2.5128352e-07) -bones/43/rotation = Quaternion(0.13051407, 0.003691554, 0.018921439, 0.99125904) -bones/44/position = Vector3(4.8907918e-09, 0.036139727, -8.499214e-09) -bones/44/rotation = Quaternion(0.15154669, 1.6962191e-06, 0.012345144, 0.988373) -bones/45/position = Vector3(-2.8403383e-07, 0.03459763, -4.4995545e-09) -bones/45/rotation = Quaternion(0.16023898, 1.233635e-06, 0.013053549, 0.98699194) -bones/46/position = Vector3(2.8485744e-07, 0.03680191, -9.493007e-09) -bones/47/position = Vector3(-0.022166327, 0.12146996, -9.982591e-05) -bones/47/rotation = Quaternion(0.1774532, 0.0045050457, 0.02645378, 0.98376334) -bones/48/position = Vector3(4.6136024e-09, 0.036011953, 3.056637e-08) -bones/48/rotation = Quaternion(0.18173504, 1.8501213e-06, 0.014812392, 0.98323596) -bones/49/position = Vector3(-3.407626e-08, 0.033073153, 1.8664657e-08) -bones/49/rotation = Quaternion(0.15551038, 3.26233e-07, 0.012668259, 0.98775303) -bones/50/position = Vector3(2.3113911e-07, 0.03660121, -1.1142021e-08) -bones/51/position = Vector3(-0.047258336, 0.109081805, 0.0022614468) -bones/51/rotation = Quaternion(0.22849467, 0.003407588, 0.042977322, 0.97259015) -bones/52/position = Vector3(-1.5261804e-08, 0.041366428, -1.9607107e-09) -bones/52/rotation = Quaternion(0.1515478, 7.4422354e-07, 0.01235583, 0.98837274) -bones/53/position = Vector3(1.4340932e-08, 0.025948457, 3.3946527e-08) -bones/53/rotation = Quaternion(0.14377311, 5.8452275e-07, 0.011701506, 0.98954153) -bones/54/position = Vector3(4.750415e-09, 0.029238641, -1.2388978e-09) -bones/55/position = Vector3(0.09123873, -0.06657194, -0.0005540352) -bones/55/rotation = Quaternion(0.136, 0.07837879, 0.98449296, -0.07832257) -bones/56/position = Vector3(-1.3288446e-09, 0.40599436, 1.0443015e-08) -bones/56/rotation = Quaternion(-0.1325433, -0.014470397, 0.03215335, 0.9905499) -bones/57/position = Vector3(5.707578e-09, 0.42099008, -1.5425995e-08) -bones/57/rotation = Quaternion(0.5344709, -0.021695312, -0.027452054, 0.8444624) -bones/58/position = Vector3(-6.5650525e-09, 0.15721555, -2.6694579e-08) -bones/58/rotation = Quaternion(0.2693438, -0.032380052, -0.014592491, 0.96238893) -bones/59/position = Vector3(2.4854705e-08, 0.09999996, -3.1755625e-09) -bones/60/position = Vector3(-0.091250315, -0.066556, -0.0005535231) -bones/60/rotation = Quaternion(-0.09026675, -0.016730117, 0.9954149, -0.026855767) -bones/61/position = Vector3(1.3129254e-08, 0.40599442, 3.8557886e-09) -bones/61/rotation = Quaternion(-0.07409451, 0.08402694, -0.024555309, 0.9934016) -bones/62/position = Vector3(-7.3885964e-10, 0.42099023, -5.226429e-09) -bones/62/rotation = Quaternion(0.5654398, 0.01134551, -0.008516049, 0.8246677) -bones/63/position = Vector3(7.93632e-09, 0.1572156, -2.6982683e-10) -bones/63/rotation = Quaternion(0.2890854, 0.031904142, 0.014081784, 0.9566679) -bones/64/position = Vector3(7.567915e-10, 0.099999994, -3.2595668e-09) - [node name="CollisionShape3D" type="CollisionShape3D" parent="Player"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, 0) shape = SubResource("SphereShape3D_mx8sn") @@ -208,6 +253,11 @@ fov = 49.0 [node name="SpotLight3D" type="SpotLight3D" parent="Player"] +[node name="AnimationTree" type="AnimationTree" parent="Player"] +root_node = NodePath("../TestCharAnimated") +tree_root = SubResource("AnimationNodeStateMachine_bwsrl") +anim_player = NodePath("../TestCharAnimated/AnimationPlayer") + [node name="Car" parent="." instance=ExtResource("5_car")] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6, 0, -3)