diff --git a/godot/objects/player.tscn b/godot/objects/player.tscn index 0bce5c2..eaadc89 100644 --- a/godot/objects/player.tscn +++ b/godot/objects/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=28 format=3 uid="uid://1kr3qqan3trk"] +[gd_scene load_steps=29 format=3 uid="uid://1kr3qqan3trk"] [ext_resource type="PackedScene" uid="uid://vub54xgk5n0h" path="res://models/character.glb" id="1_mi4co"] @@ -17,9 +17,41 @@ animation = &"Aim" [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8rbkq"] animation = &"Aim_Fire" -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_dqnnp"] +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_4hmb8"] +filter_enabled = true +filters = ["Character/Skeleton3D:Foot.L", "Character/Skeleton3D:Foot.R", "Character/Skeleton3D:IKTarget.Foot.L", "Character/Skeleton3D:IKTarget.Foot.R", "Character/Skeleton3D:Neck", "Character/Skeleton3D:PoleTarget.Foot.L", "Character/Skeleton3D:PoleTarget.Foot.R", "Character/Skeleton3D:hip", "Character/Skeleton3D:lowerleg.L", "Character/Skeleton3D:lowerleg.R", "Character/Skeleton3D:root", "Character/Skeleton3D:spine.001", "Character/Skeleton3D:spine.002", "Character/Skeleton3D:spine.003", "Character/Skeleton3D:upperleg.L", "Character/Skeleton3D:upperleg.R"] + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_5n7ai"] animation = &"RESET" +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_cmc4t"] +animation = &"Turn_right" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_wfckx"] +animation = &"Turn_left" + +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_6neek"] +animation = &"RESET" + +[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_kxn5j"] +blend_point_0/node = SubResource("AnimationNodeAnimation_cmc4t") +blend_point_0/pos = -1.0 +blend_point_1/node = SubResource("AnimationNodeAnimation_wfckx") +blend_point_1/pos = 1.0 +blend_point_2/node = SubResource("AnimationNodeAnimation_6neek") +blend_point_2/pos = 0.0 + +[sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_p0hk7"] +graph_offset = Vector2(-599, 14) +nodes/BoneMask/node = SubResource("AnimationNodeBlend2_4hmb8") +nodes/BoneMask/position = Vector2(140, 140) +nodes/Rest/node = SubResource("AnimationNodeAnimation_5n7ai") +nodes/Rest/position = Vector2(-100, 160) +nodes/Turn/node = SubResource("AnimationNodeBlendSpace1D_kxn5j") +nodes/Turn/position = Vector2(-100, 380) +nodes/output/position = Vector2(380, 140) +node_connections = [&"BoneMask", 0, &"Rest", &"BoneMask", 1, &"Turn", &"output", 0, &"BoneMask"] + [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_7ceai"] animation = &"RESET" @@ -40,35 +72,13 @@ nodes/Walk/node = SubResource("AnimationNodeAnimation_psu0r") nodes/Walk/position = Vector2(-140, 300) node_connections = [&"Forward", 0, &"Base", &"Forward", 1, &"Walk", &"output", 0, &"Forward"] -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_3mk5o"] -xfade_time = 0.2 -advance_mode = 2 -advance_expression = "get_input_directions().y > 0.5" - -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mf4y3"] -xfade_time = 0.6 -priority = 2 -advance_mode = 2 -advance_expression = "get_input_directions().y <= 0.5" - -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_c81tj"] -advance_mode = 2 -advance_expression = "get_input_directions().y < -0.9" - -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_r26s5"] -advance_mode = 2 - [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4lybd"] switch_mode = 2 advance_mode = 2 advance_expression = "get_input_directions().y >= -0.9" -[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4im1q"] -priority = 2 -switch_mode = 2 -advance_mode = 2 - [sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_5aafd"] +xfade_time = 0.3 switch_mode = 2 advance_mode = 2 advance_expression = "get_input_direction() > 0.f" @@ -88,52 +98,50 @@ advance_mode = 2 advance_mode = 2 advance_expression = "get_input_directions().y < -0.5" +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_n0ndr"] +priority = 2 +switch_mode = 2 +advance_mode = 2 + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_0wc5e"] +xfade_time = 0.2 +priority = 2 +advance_mode = 2 +advance_expression = "get_input_directions().y < 0.5" + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4hisb"] +xfade_time = 0.2 +advance_mode = 2 +advance_expression = "get_input_directions().y >= 0.5" + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_333v8"] +advance_mode = 2 +advance_expression = "get_input_directions().y < -0.9" + +[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_bmty6"] +advance_mode = 2 + [sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_7smdg"] "states/Aim Down [aim]/node" = SubResource("AnimationNodeAnimation_ukhqm") -"states/Aim Down [aim]/position" = Vector2(583.446, 263.781) +"states/Aim Down [aim]/position" = Vector2(706.171, 191.767) "states/Aim [aim] [turn]/node" = SubResource("AnimationNodeAnimation_nhlru") -"states/Aim [aim] [turn]/position" = Vector2(583.364, 97.9174) -states/End/position = Vector2(204, 197.5) +"states/Aim [aim] [turn]/position" = Vector2(705.26, 88.389) +states/End/position = Vector2(195.182, 94.3447) "states/Fire [aim]/node" = SubResource("AnimationNodeAnimation_8rbkq") -"states/Fire [aim]/position" = Vector2(798.864, 97.9174) -"states/Idle [turn_animated]/node" = SubResource("AnimationNodeAnimation_dqnnp") -"states/Idle [turn_animated]/position" = Vector2(384.364, 99.9174) -states/Start/position = Vector2(204, 100) +"states/Fire [aim]/position" = Vector2(706.18, 14.9346) +states/Start/position = Vector2(383.995, 14.954) +"states/Stationary [turn]/node" = SubResource("AnimationNodeBlendTree_p0hk7") +"states/Stationary [turn]/position" = Vector2(383.995, 94.3447) "states/Walk [turn]/node" = SubResource("AnimationNodeBlendTree_2mbyh") -"states/Walk [turn]/position" = Vector2(384.446, 263.781) -transitions = ["Idle [turn_animated]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_3mk5o"), "Walk [turn]", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_mf4y3"), "Idle [turn_animated]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_c81tj"), "Start", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_r26s5"), "Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Idle [turn_animated]", SubResource("AnimationNodeStateMachineTransition_4im1q"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos")] -graph_offset = Vector2(-151.601, -33.5439) - -[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_cwpxw"] -filter_enabled = true -filters = ["Character/Skeleton3D:Foot.L", "Character/Skeleton3D:Foot.R", "Character/Skeleton3D:IKTarget.Foot.L", "Character/Skeleton3D:IKTarget.Foot.R", "Character/Skeleton3D:Neck", "Character/Skeleton3D:PoleTarget.Foot.L", "Character/Skeleton3D:PoleTarget.Foot.R", "Character/Skeleton3D:hip", "Character/Skeleton3D:lowerleg.L", "Character/Skeleton3D:lowerleg.R", "Character/Skeleton3D:spine.001", "Character/Skeleton3D:spine.002", "Character/Skeleton3D:spine.003", "Character/Skeleton3D:upperleg.L", "Character/Skeleton3D:upperleg.R"] - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ltmcj"] -animation = &"Turn_left" - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_1g6a2"] -animation = &"Turn_right" - -[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_dgkx8"] -animation = &"RESET" - -[sub_resource type="AnimationNodeBlendSpace1D" id="AnimationNodeBlendSpace1D_ajqf0"] -blend_point_0/node = SubResource("AnimationNodeAnimation_ltmcj") -blend_point_0/pos = 1.0 -blend_point_1/node = SubResource("AnimationNodeAnimation_1g6a2") -blend_point_1/pos = -1.0 -blend_point_2/node = SubResource("AnimationNodeAnimation_dgkx8") -blend_point_2/pos = 0.0 +"states/Walk [turn]/position" = Vector2(383.995, 191.767) +transitions = ["Aim [aim] [turn]", "Aim Down [aim]", SubResource("AnimationNodeStateMachineTransition_4lybd"), "Aim Down [aim]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_5aafd"), "Aim [aim] [turn]", "Fire [aim]", SubResource("AnimationNodeStateMachineTransition_8f4gl"), "Fire [aim]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_xnat3"), "Walk [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_12bos"), "Aim Down [aim]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_n0ndr"), "Walk [turn]", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_0wc5e"), "Stationary [turn]", "Walk [turn]", SubResource("AnimationNodeStateMachineTransition_4hisb"), "Stationary [turn]", "Aim [aim] [turn]", SubResource("AnimationNodeStateMachineTransition_333v8"), "Start", "Stationary [turn]", SubResource("AnimationNodeStateMachineTransition_bmty6")] +graph_offset = Vector2(-98.007, -6.1553) [sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_hiswf"] -graph_offset = Vector2(-380, 0) nodes/Actions/node = SubResource("AnimationNodeStateMachine_7smdg") -nodes/Actions/position = Vector2(-80, 140) -nodes/TurnAnimation/node = SubResource("AnimationNodeBlend2_cwpxw") -nodes/TurnAnimation/position = Vector2(120, 140) -nodes/TurnDirection/node = SubResource("AnimationNodeBlendSpace1D_ajqf0") -nodes/TurnDirection/position = Vector2(-80, 300) -node_connections = [&"TurnAnimation", 0, &"Actions", &"TurnAnimation", 1, &"TurnDirection", &"output", 0, &"TurnAnimation"] +nodes/Actions/position = Vector2(90.9091, 145.455) +nodes/output/position = Vector2(327.273, 163.636) +node_connections = [&"output", 0, &"Actions"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_ewsvd"] radius = 0.370388 @@ -249,9 +257,9 @@ root_motion_track = NodePath("Character/Skeleton3D:root") tree_root = SubResource("AnimationNodeBlendTree_hiswf") advance_expression_base_node = NodePath("../..") anim_player = NodePath("../AnimationPlayer") +"parameters/Actions/Stationary [turn]/BoneMask/blend_amount" = 1.0 +"parameters/Actions/Stationary [turn]/Turn/blend_position" = 0 "parameters/Actions/Walk [turn]/Forward/blend_amount" = 1.0 -parameters/TurnAnimation/blend_amount = 0 -parameters/TurnDirection/blend_position = -1.0 [node name="CollisionShape3D" type="CollisionShape3D" parent="."] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) @@ -262,7 +270,7 @@ unique_name_in_owner = true top_level = true [node name="Camera" type="Camera3D" parent="CameraParent"] -transform = Transform3D(-0.99874, 0.00680423, -0.0497112, -1.86265e-08, 0.990762, 0.135611, 0.0501747, 0.13544, -0.989514, -0.510957, 1.68471, -1.00759) +transform = Transform3D(-0.999748, 0.00680423, -0.0213691, 0.00384561, 0.990762, 0.135556, 0.0220941, 0.13544, -0.990539, -0.434839, 1.68404, -1.00653) fov = 42.5804 far = 100.0 diff --git a/godot/project.godot b/godot/project.godot index 9b602bf..0cde35c 100644 --- a/godot/project.godot +++ b/godot/project.godot @@ -41,13 +41,18 @@ dir_backward={ dir_left={ "deadzone": 0.2, "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":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":-1.0,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null) ] } dir_right={ "deadzone": 0.2, "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":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) +, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null) +] +} +look_right={ +"deadzone": 0.2, +"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) ] } look_left={ @@ -60,11 +65,6 @@ look_up={ "events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":-1.0,"script":null) ] } -look_right={ -"deadzone": 0.2, -"events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":2,"axis_value":1.0,"script":null) -] -} look_down={ "deadzone": 0.2, "events": [Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":3,"axis_value":1.0,"script":null) @@ -73,7 +73,7 @@ look_down={ fire={ "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":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null) -, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":3,"pressure":0.0,"pressed":true,"script":null) +, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":2,"pressure":0.0,"pressed":true,"script":null) ] } diff --git a/models/character.blend b/models/character.blend index 1bc7d15..653b44f 100644 --- a/models/character.blend +++ b/models/character.blend @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:3142bfa44ccacb5cf3ef92199da6ae0cd4ffbb140f15ed121803e3bcfdcd1412 +oid sha256:cf53aee27e4cfef32d0cf5fdb938c652df08919a66be916b9cb5e37798cf314c size 2516476 diff --git a/models/character.blend1 b/models/character.blend1 index 19d9662..8b52cf8 100644 Binary files a/models/character.blend1 and b/models/character.blend1 differ diff --git a/src/player.cpp b/src/player.cpp index 6aa387e..064a391 100644 --- a/src/player.cpp +++ b/src/player.cpp @@ -62,11 +62,9 @@ void Player::process_rotate(double delta) { float const actual_speed{speed < gd::Math::abs(diff) ? gd::Math::sign(diff) * speed : diff}; // rotate by max allowed or full difference, whichever has the smaller magnitude this->rotate_y(actual_speed); - this->anim_tree->set("parameters/TurnDirection/blend_position", diff * M_PI_2f); - this->anim_tree->set("parameters/TurnAnimation/blend_amount", this->fsm->get_current_node().contains("[turn_animated]") ? 1.f : 0.f); + this->anim_tree->set("parameters/Actions/Stationary [turn]/Turn/blend_position", diff * M_PI_2f); } else { - this->anim_tree->set("parameters/TurnAnimation/blend_amount", 0.f); - this->anim_tree->set("parameters/TurnDirection/blend_position", 0.f); + this->anim_tree->set("parameters/Actions/Stationary [turn_animated]/blend_position", 0.f); } }