diff --git a/assets/models/character.blend b/assets/models/character.blend index bcedd9c..8d36c30 100644 Binary files a/assets/models/character.blend and b/assets/models/character.blend differ diff --git a/player/AnimationController.cs b/player/AnimationController.cs index a03e09f..72eb7a6 100644 --- a/player/AnimationController.cs +++ b/player/AnimationController.cs @@ -37,6 +37,7 @@ public partial class AnimationController : Node3D HandleTurning(delta); HandleLookingAnimation(delta); HandleWalkingAnimation(delta); + HandleHoldingAnimation(delta); } void ResetTransforms() @@ -136,11 +137,14 @@ public partial class AnimationController : Node3D var walkDirection = isMovingForward ? "forward" : "backward"; var walkSpeed = movement.LocalMoveVector.Length() / movement.MaxSpeed; - _animTree.Set("parameters/walk_state/transition_request", walkState); - _animTree.Set("parameters/walk_direction/transition_request", walkDirection); + const string WalkStateParam = "parameters/walk_state/transition_request"; + const string WalkDirectionParam = "parameters/walk_direction/transition_request"; + const string WalkSpeedParam = "parameters/walk_speed/blend_amount"; - var prevWalkSpeed = (float)_animTree.Get("parameters/walk_speed/blend_amount"); - _animTree.Set("parameters/walk_speed/blend_amount", Lerp(prevWalkSpeed, walkSpeed, 10 * (float)delta)); + _animTree.Set(WalkStateParam, walkState); + _animTree.Set(WalkDirectionParam, walkDirection); + var prevWalkSpeed = (float)_animTree.Get(WalkSpeedParam); + _animTree.Set(WalkSpeedParam, Lerp(prevWalkSpeed, walkSpeed, 10 * (float)delta)); const float YawFactorLowerBody = 0.15f; const float YawFactorUpperBody = 0.20f; @@ -158,4 +162,23 @@ public partial class AnimationController : Node3D _bones["UpperBody"].GlobalRotate(Vector3.Up, -_bodyYaw * YawFactorUpperBody); _bones["Neck" ].GlobalRotate(Vector3.Up, -_bodyYaw * YawFactorNeck); } + + Vector3? _defaultPickupPosition; + void HandleHoldingAnimation(double delta) + { + var posPickup = _defaultPickupPosition ??= _player.Pickup.Position; + posPickup = _player.GlobalPosition + posPickup.Rotated(Vector3.Up, Tau / 2 + _bones["UpperBody"].GlobalRotation.Y); + + var posWristR = _bones["Wrist_R"].GlobalPosition; + var posWristL = _bones["Wrist_L"].GlobalPosition; + _player.Pickup.GlobalPosition = (posPickup + posWristR + posWristL) / 3; + _player.Pickup.Rotation = _player.Pickup.Rotation with { Y = _bones["UpperBody"].Rotation.Y }; + + const string IsHoldingParam = "parameters/is_holding/blend_amount"; + + var isHolding = _player.Pickup.HasItemsHeld ? 0.9f : 0.0f; + var prevIsHolding = (float)_animTree.Get(IsHoldingParam); + _animTree.Set(IsHoldingParam, Lerp(prevIsHolding, isHolding, 8 * (float)delta)); + // TODO: Bob `PickupController` up and down dependent on animation cycle. + } } diff --git a/player/PickupController.cs b/player/PickupController.cs index 9b6eb85..dfc2023 100644 --- a/player/PickupController.cs +++ b/player/PickupController.cs @@ -1,7 +1,7 @@ public partial class PickupController : Node3D { public Item CurrentItem { get; private set; } - public bool IsCurrentItemHeld { get; private set; } + public bool HasItemsHeld => GetChildCount() > 0; MeshInstance3D _placementPreview; [Export] public Camera3D Camera { get; set; } @@ -23,9 +23,7 @@ public partial class PickupController : Node3D if (CurrentItem == null) return; if (@event.IsActionPressed("interact_pickup")) { - if (!IsCurrentItemHeld) { - IsCurrentItemHeld = true; - + if (!HasItemsHeld) { // Parent item to the `PickupController`. var prevRot = CurrentItem.GlobalRotation; CurrentItem.GetParent().RemoveChild(CurrentItem); @@ -39,9 +37,7 @@ public partial class PickupController : Node3D GetViewport().SetInputAsHandled(); } } else if (@event.IsActionPressed("interact_place")) { - if (IsCurrentItemHeld) { - IsCurrentItemHeld = false; - + if (HasItemsHeld) { // Parent item back to the world. var prevTransform = CurrentItem.GlobalTransform; CurrentItem.CollisionLayer |= (uint)PhysicsLayer.Static; @@ -60,7 +56,7 @@ public partial class PickupController : Node3D if (!_player.IsLocal) return; EnsureCurrentItemValid(); - if (IsCurrentItemHeld) { + if (HasItemsHeld) { if ((RayToMouseCursor() is RayResult ray) && (ray.Collider is Grid)) { // Snao rotation to nearest axis. // FIXME: This needs to snap to the @@ -93,8 +89,7 @@ public partial class PickupController : Node3D if (CurrentItem == null) return; if (!IsInstanceValid(CurrentItem)) { CurrentItem = null; - IsCurrentItemHeld = false; - _placementPreview.QueueFree(); + _placementPreview?.QueueFree(); } } @@ -108,7 +103,7 @@ public partial class PickupController : Node3D query.CollisionMask = (uint)PhysicsLayer.Interactable; query.CollideWithAreas = true; // Exclude the `CurrentItem` from collision checking if it's being held. - query.Exclude = IsCurrentItemHeld ? [ CurrentItem.GetRid() ] : []; + query.Exclude = HasItemsHeld ? [ CurrentItem.GetRid() ] : []; var result = GetWorld3D().DirectSpaceState.IntersectRay(query); return (result.Count > 0) ? new(result) : null; diff --git a/player/player.tscn b/player/player.tscn index 8e684db..357147b 100644 --- a/player/player.tscn +++ b/player/player.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=26 format=3 uid="uid://dmd7w2r8s0x6y"] +[gd_scene load_steps=29 format=3 uid="uid://dmd7w2r8s0x6y"] [ext_resource type="PackedScene" uid="uid://bfh3eqgywr0ul" path="res://assets/models/character.blend" id="1_3qh37"] [ext_resource type="Script" path="res://player/Player.cs" id="1_a0mas"] @@ -37,7 +37,152 @@ properties/5/path = NodePath("CameraController:CurrentYaw") properties/5/spawn = true properties/5/replication_mode = 1 -[sub_resource type="Animation" id="Animation_5wsog"] +[sub_resource type="Animation" id="Animation_ptf2s"] +resource_name = "hold_loop" +length = 2.5 +loop_mode = 1 +tracks/0/type = "rotation_3d" +tracks/0/imported = true +tracks/0/enabled = true +tracks/0/path = NodePath("Skeleton/Skeleton3D:UpperArm_L") +tracks/0/interp = 1 +tracks/0/loop_wrap = true +tracks/0/keys = PackedFloat32Array(0, 1, -0.0121095, -0.0624052, -0.98932, 0.13117, 0.2, 1, -0.0119305, -0.0612773, -0.989296, 0.131894, 0.333333, 1, -0.0116405, -0.0594502, -0.989254, 0.133065, 0.4, 1, -0.0114591, -0.0583076, -0.989226, 0.133797, 0.466667, 1, -0.0112622, -0.0570671, -0.989192, 0.134592, 0.533333, 1, -0.0110531, -0.0557501, -0.989155, 0.135435, 0.633333, 1, -0.0107283, -0.053704, -0.989091, 0.136744, 0.7, 1, -0.0105114, -0.0523376, -0.989046, 0.137618, 0.766667, 1, -0.0103003, -0.0510078, -0.988999, 0.138467, 0.833333, 1, -0.0100989, -0.0497389, -0.988952, 0.139278, 0.9, 1, -0.00991441, -0.0485769, -0.988907, 0.14002, 0.966667, 1, -0.00974931, -0.0475369, -0.988865, 0.140683, 1.03333, 1, -0.00960991, -0.0466589, -0.988828, 0.141244, 1.13333, 1, -0.0094595, -0.0457115, -0.988787, 0.141848, 1.46667, 1, -0.00960991, -0.0466589, -0.988828, 0.141244, 1.56667, 1, -0.0098292, -0.0480401, -0.988885, 0.140362, 1.63333, 1, -0.0100045, -0.0491441, -0.988929, 0.139658, 1.7, 1, -0.0101982, -0.0503642, -0.988975, 0.138879, 1.8, 1, -0.0105114, -0.0523376, -0.989046, 0.137618, 1.9, 1, -0.0108373, -0.0543901, -0.989113, 0.136305, 1.96667, 1, -0.0110531, -0.0557501, -0.989155, 0.135435, 2.03333, 1, -0.0112622, -0.0570671, -0.989192, 0.134592, 2.1, 1, -0.0114591, -0.0583076, -0.989226, 0.133797, 2.16667, 1, -0.0116405, -0.0594502, -0.989254, 0.133065, 2.26667, 1, -0.0118677, -0.0608816, -0.989287, 0.132147, 2.36667, 1, -0.0120309, -0.0619099, -0.98931, 0.131488, 2.5, 1, -0.0121183, -0.0624612, -0.989321, 0.131134) +tracks/1/type = "rotation_3d" +tracks/1/imported = true +tracks/1/enabled = true +tracks/1/path = NodePath("Skeleton/Skeleton3D:LowerArm_L") +tracks/1/interp = 1 +tracks/1/loop_wrap = true +tracks/1/keys = PackedFloat32Array(0, 1, 0.477174, -0.251915, -0.189069, 0.820425, 0.133333, 1, 0.477501, -0.251225, -0.188098, 0.820669, 0.2, 1, 0.477918, -0.250343, -0.186859, 0.820979, 0.233333, 1, 0.478178, -0.249791, -0.186083, 0.821172, 0.266667, 1, 0.478465, -0.249179, -0.185223, 0.821385, 0.3, 1, 0.478778, -0.248511, -0.184285, 0.821616, 0.333333, 1, 0.479114, -0.247792, -0.183275, 0.821864, 0.466667, 1, 0.480658, -0.244456, -0.178596, 0.82299, 0.5, 1, 0.481076, -0.243546, -0.17732, 0.823292, 0.533333, 1, 0.481504, -0.242609, -0.176008, 0.823599, 0.566667, 1, 0.481936, -0.241659, -0.174677, 0.823909, 0.666667, 1, 0.483241, -0.238769, -0.170633, 0.824834, 0.7, 1, 0.48367, -0.237812, -0.169294, 0.825135, 0.733333, 1, 0.484091, -0.236867, -0.167972, 0.82543, 0.766667, 1, 0.484504, -0.235938, -0.166675, 0.825717, 0.833333, 1, 0.485295, -0.234148, -0.164174, 0.826263, 0.866667, 1, 0.485663, -0.233308, -0.163001, 0.826516, 0.9, 1, 0.486014, -0.232507, -0.161883, 0.826756, 0.933333, 1, 0.486345, -0.231748, -0.160824, 0.826981, 0.966667, 1, 0.486654, -0.231036, -0.159831, 0.82719, 1.03333, 1, 0.487192, -0.229794, -0.158099, 0.827553, 1.1, 1, 0.487608, -0.228827, -0.156752, 0.827832, 1.16667, 1, 0.487897, -0.228155, -0.155814, 0.828024, 1.4, 1, 0.487608, -0.228827, -0.156752, 0.827832, 1.46667, 1, 0.487192, -0.229794, -0.158099, 0.827553, 1.5, 1, 0.48694, -0.230376, -0.158911, 0.827384, 1.53333, 1, 0.486654, -0.231036, -0.159831, 0.82719, 1.6, 1, 0.486014, -0.232507, -0.161883, 0.826756, 1.63333, 1, 0.485663, -0.233308, -0.163001, 0.826516, 1.66667, 1, 0.485294, -0.234148, -0.164174, 0.826263, 1.76667, 1, 0.484091, -0.236867, -0.167972, 0.82543, 1.8, 1, 0.48367, -0.237812, -0.169294, 0.825135, 1.83333, 1, 0.483241, -0.238769, -0.170633, 0.824834, 1.9, 1, 0.482372, -0.240699, -0.173334, 0.824219, 2, 1, 0.481076, -0.243546, -0.17732, 0.823292, 2.03333, 1, 0.480658, -0.244456, -0.178596, 0.82299, 2.06667, 1, 0.480251, -0.24534, -0.179836, 0.822695, 2.1, 1, 0.479856, -0.246193, -0.181033, 0.822407, 2.13333, 1, 0.479477, -0.247012, -0.182181, 0.82213, 2.2, 1, 0.478778, -0.248511, -0.184285, 0.821616, 2.23333, 1, 0.478465, -0.249179, -0.185223, 0.821385, 2.26667, 1, 0.478178, -0.249791, -0.186083, 0.821172, 2.33333, 1, 0.477687, -0.250831, -0.187544, 0.820808, 2.4, 1, 0.477351, -0.251543, -0.188545, 0.820557, 2.5, 1, 0.477137, -0.251993, -0.189178, 0.820397) +tracks/2/type = "rotation_3d" +tracks/2/imported = true +tracks/2/enabled = true +tracks/2/path = NodePath("Skeleton/Skeleton3D:Wrist_L") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = PackedFloat32Array(0, 1, -0.0502735, -0.237958, -0.106132, 0.96415) +tracks/3/type = "rotation_3d" +tracks/3/imported = true +tracks/3/enabled = true +tracks/3/path = NodePath("Skeleton/Skeleton3D:UpperArm_R") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = PackedFloat32Array(0, 1, -0.0121095, 0.0624052, 0.98932, 0.13117, 0.2, 1, -0.0119305, 0.0612773, 0.989296, 0.131894, 0.333333, 1, -0.0116405, 0.0594502, 0.989254, 0.133065, 0.4, 1, -0.0114591, 0.0583076, 0.989226, 0.133797, 0.466667, 1, -0.0112622, 0.0570671, 0.989192, 0.134592, 0.533333, 1, -0.0110531, 0.0557501, 0.989155, 0.135435, 0.633333, 1, -0.0107283, 0.053704, 0.989091, 0.136744, 0.7, 1, -0.0105114, 0.0523376, 0.989046, 0.137618, 0.766667, 1, -0.0103003, 0.0510078, 0.988999, 0.138467, 0.833333, 1, -0.0100989, 0.0497389, 0.988952, 0.139278, 0.9, 1, -0.00991441, 0.0485769, 0.988907, 0.14002, 0.966667, 1, -0.00974931, 0.0475369, 0.988865, 0.140683, 1.03333, 1, -0.00960991, 0.0466589, 0.988828, 0.141244, 1.13333, 1, -0.0094595, 0.0457115, 0.988787, 0.141848, 1.46667, 1, -0.00960991, 0.0466589, 0.988828, 0.141244, 1.56667, 1, -0.0098292, 0.0480401, 0.988885, 0.140362, 1.63333, 1, -0.0100045, 0.0491441, 0.988929, 0.139658, 1.7, 1, -0.0101982, 0.0503642, 0.988975, 0.138879, 1.8, 1, -0.0105114, 0.0523376, 0.989046, 0.137618, 1.9, 1, -0.0108373, 0.0543901, 0.989113, 0.136305, 1.96667, 1, -0.0110531, 0.0557501, 0.989155, 0.135435, 2.03333, 1, -0.0112622, 0.0570671, 0.989192, 0.134592, 2.1, 1, -0.0114591, 0.0583076, 0.989226, 0.133797, 2.16667, 1, -0.0116405, 0.0594502, 0.989254, 0.133065, 2.26667, 1, -0.0118677, 0.0608816, 0.989287, 0.132147, 2.36667, 1, -0.0120309, 0.0619099, 0.98931, 0.131488, 2.5, 1, -0.0121183, 0.0624612, 0.989321, 0.131134) +tracks/4/type = "rotation_3d" +tracks/4/imported = true +tracks/4/enabled = true +tracks/4/path = NodePath("Skeleton/Skeleton3D:LowerArm_R") +tracks/4/interp = 1 +tracks/4/loop_wrap = true +tracks/4/keys = PackedFloat32Array(0, 1, 0.477174, 0.251915, 0.189069, 0.820425, 0.133333, 1, 0.477501, 0.251225, 0.188098, 0.820669, 0.2, 1, 0.477918, 0.250343, 0.186859, 0.820979, 0.233333, 1, 0.478178, 0.249791, 0.186083, 0.821172, 0.266667, 1, 0.478465, 0.249179, 0.185223, 0.821385, 0.3, 1, 0.478778, 0.248511, 0.184285, 0.821616, 0.333333, 1, 0.479114, 0.247792, 0.183275, 0.821864, 0.366667, 1, 0.479477, 0.247012, 0.182181, 0.82213, 0.466667, 1, 0.480658, 0.244456, 0.178596, 0.82299, 0.5, 1, 0.481076, 0.243546, 0.17732, 0.823292, 0.533333, 1, 0.481504, 0.242609, 0.176008, 0.823599, 0.6, 1, 0.482371, 0.240699, 0.173334, 0.824219, 0.666667, 1, 0.483241, 0.238769, 0.170633, 0.824834, 0.733333, 1, 0.484091, 0.236867, 0.167972, 0.82543, 0.766667, 1, 0.484504, 0.235938, 0.166675, 0.825717, 0.8, 1, 0.484906, 0.23503, 0.165406, 0.825995, 0.866667, 1, 0.485663, 0.233308, 0.163001, 0.826516, 0.9, 1, 0.486014, 0.232507, 0.161883, 0.826756, 0.933333, 1, 0.486345, 0.231748, 0.160824, 0.826981, 0.966667, 1, 0.486654, 0.231036, 0.159831, 0.82719, 1, 1, 0.48694, 0.230376, 0.158911, 0.827383, 1.03333, 1, 0.487192, 0.229794, 0.158099, 0.827553, 1.1, 1, 0.487608, 0.228827, 0.156752, 0.827832, 1.16667, 1, 0.487897, 0.228155, 0.155814, 0.828024, 1.4, 1, 0.487608, 0.228827, 0.156752, 0.827832, 1.46667, 1, 0.487192, 0.229794, 0.158099, 0.827553, 1.5, 1, 0.48694, 0.230376, 0.158911, 0.827383, 1.53333, 1, 0.486654, 0.231036, 0.159831, 0.82719, 1.6, 1, 0.486014, 0.232507, 0.161883, 0.826756, 1.63333, 1, 0.485663, 0.233308, 0.163001, 0.826516, 1.66667, 1, 0.485295, 0.234148, 0.164174, 0.826263, 1.7, 1, 0.484906, 0.23503, 0.165406, 0.825995, 1.73333, 1, 0.484504, 0.235938, 0.166675, 0.825717, 1.76667, 1, 0.484091, 0.236867, 0.167972, 0.82543, 1.8, 1, 0.48367, 0.237812, 0.169294, 0.825135, 1.83333, 1, 0.483241, 0.238769, 0.170633, 0.824834, 1.9, 1, 0.482371, 0.240699, 0.173334, 0.824219, 1.96667, 1, 0.481504, 0.242609, 0.176008, 0.8236, 2.03333, 1, 0.480658, 0.244456, 0.178596, 0.82299, 2.06667, 1, 0.480251, 0.24534, 0.179836, 0.822695, 2.1, 1, 0.479856, 0.246193, 0.181033, 0.822407, 2.16667, 1, 0.479114, 0.247792, 0.183275, 0.821864, 2.2, 1, 0.478778, 0.248511, 0.184285, 0.821616, 2.23333, 1, 0.478465, 0.249179, 0.185223, 0.821385, 2.26667, 1, 0.478178, 0.249791, 0.186083, 0.821172, 2.3, 1, 0.477918, 0.250343, 0.186859, 0.820979, 2.36667, 1, 0.477501, 0.251225, 0.188098, 0.820669, 2.43333, 1, 0.477239, 0.251779, 0.188878, 0.820473, 2.5, 1, 0.477137, 0.251993, 0.189178, 0.820397) +tracks/5/type = "rotation_3d" +tracks/5/imported = true +tracks/5/enabled = true +tracks/5/path = NodePath("Skeleton/Skeleton3D:Wrist_R") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = PackedFloat32Array(0, 1, -0.0502736, 0.237958, 0.106132, 0.96415) +tracks/6/type = "rotation_3d" +tracks/6/imported = true +tracks/6/enabled = true +tracks/6/path = NodePath("Skeleton/Skeleton3D:UpperLeg_L") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = PackedFloat32Array(0, 1, 0.0098597, -0.701126, 0.712906, 0.00952086) +tracks/7/type = "rotation_3d" +tracks/7/imported = true +tracks/7/enabled = true +tracks/7/path = NodePath("Skeleton/Skeleton3D:UpperLeg_R") +tracks/7/interp = 1 +tracks/7/loop_wrap = true +tracks/7/keys = PackedFloat32Array(0, 1, 0.00985971, 0.701126, -0.712906, 0.00952085) +tracks/8/type = "position_3d" +tracks/8/imported = true +tracks/8/enabled = true +tracks/8/path = NodePath("Skeleton/Skeleton3D:Root") +tracks/8/interp = 1 +tracks/8/loop_wrap = true +tracks/8/keys = PackedFloat32Array(0, 1, 0, 0.2, 0) +tracks/9/type = "position_3d" +tracks/9/imported = true +tracks/9/enabled = true +tracks/9/path = NodePath("Skeleton/Skeleton3D:IK_LegTarget_L") +tracks/9/interp = 1 +tracks/9/loop_wrap = true +tracks/9/keys = PackedFloat32Array(0, 1, 0.0827106, -0.787835, -0.0142412) +tracks/10/type = "rotation_3d" +tracks/10/imported = true +tracks/10/enabled = true +tracks/10/path = NodePath("Skeleton/Skeleton3D:IK_LegTarget_L") +tracks/10/interp = 1 +tracks/10/loop_wrap = true +tracks/10/keys = PackedFloat32Array(0, 1, -0.707107, 0, 0, 0.707107) +tracks/11/type = "position_3d" +tracks/11/imported = true +tracks/11/enabled = true +tracks/11/path = NodePath("Skeleton/Skeleton3D:IK_LegTarget_R") +tracks/11/interp = 1 +tracks/11/loop_wrap = true +tracks/11/keys = PackedFloat32Array(0, 1, -0.0827106, -0.787835, -0.0142412) +tracks/12/type = "rotation_3d" +tracks/12/imported = true +tracks/12/enabled = true +tracks/12/path = NodePath("Skeleton/Skeleton3D:IK_LegTarget_R") +tracks/12/interp = 1 +tracks/12/loop_wrap = true +tracks/12/keys = PackedFloat32Array(0, 1, -0.707107, 0, 0, 0.707107) +tracks/13/type = "rotation_3d" +tracks/13/imported = true +tracks/13/enabled = true +tracks/13/path = NodePath("Skeleton/Skeleton3D:LowerBody") +tracks/13/interp = 1 +tracks/13/loop_wrap = true +tracks/13/keys = PackedFloat32Array(0, 1, 2.96978e-08, 0.733762, 0.679407, 3.20738e-08) +tracks/14/type = "rotation_3d" +tracks/14/imported = true +tracks/14/enabled = true +tracks/14/path = NodePath("Skeleton/Skeleton3D:UpperBody") +tracks/14/interp = 1 +tracks/14/loop_wrap = true +tracks/14/keys = PackedFloat32Array(0, 1, -0.0619498, 4.36274e-08, 2.70791e-09, 0.998079) +tracks/15/type = "rotation_3d" +tracks/15/imported = true +tracks/15/enabled = true +tracks/15/path = NodePath("Skeleton/Skeleton3D:Head") +tracks/15/interp = 1 +tracks/15/loop_wrap = true +tracks/15/keys = PackedFloat32Array(0, 1, 3.09086e-08, 0.707107, 0.707107, 3.09086e-08) +tracks/16/type = "rotation_3d" +tracks/16/imported = true +tracks/16/enabled = true +tracks/16/path = NodePath("Skeleton/Skeleton3D:LowerLeg_L") +tracks/16/interp = 1 +tracks/16/loop_wrap = true +tracks/16/keys = PackedFloat32Array(0, 1, 0.0118625, 0.00254901, 0.000724309, 0.999926) +tracks/17/type = "rotation_3d" +tracks/17/imported = true +tracks/17/enabled = true +tracks/17/path = NodePath("Skeleton/Skeleton3D:Foot_L") +tracks/17/interp = 1 +tracks/17/loop_wrap = true +tracks/17/keys = PackedFloat32Array(0, 1, 0.000979768, 0.692411, -0.721249, 0.0191423) +tracks/18/type = "rotation_3d" +tracks/18/imported = true +tracks/18/enabled = true +tracks/18/path = NodePath("Skeleton/Skeleton3D:LowerLeg_R") +tracks/18/interp = 1 +tracks/18/loop_wrap = true +tracks/18/keys = PackedFloat32Array(0, 1, 0.0118625, -0.00254901, -0.000724309, 0.999926) +tracks/19/type = "rotation_3d" +tracks/19/imported = true +tracks/19/enabled = true +tracks/19/path = NodePath("Skeleton/Skeleton3D:Foot_R") +tracks/19/interp = 1 +tracks/19/loop_wrap = true +tracks/19/keys = PackedFloat32Array(0, 1, 0.000979768, -0.692411, 0.721249, 0.0191423) + +[sub_resource type="Animation" id="Animation_0g7nm"] resource_name = "idle_loop" length = 2.5 loop_mode = 1 @@ -182,7 +327,7 @@ tracks/19/interp = 1 tracks/19/loop_wrap = true tracks/19/keys = PackedFloat32Array(0, 1, -0.707001, 4.51326e-18, -4.26954e-18, 0.707212, 0.166667, 1, -0.707898, 4.51333e-18, -4.26961e-18, 0.706315, 0.233333, 1, -0.708755, 4.5134e-18, -4.26967e-18, 0.705454, 0.3, 1, -0.709809, 4.51347e-18, -4.26974e-18, 0.704395, 0.366667, 1, -0.711039, 4.51354e-18, -4.26981e-18, 0.703153, 0.466667, 1, -0.713127, 4.51363e-18, -4.26989e-18, 0.701034, 0.5, 1, -0.713869, 4.51366e-18, -4.26991e-18, 0.700279, 0.533333, 1, -0.71463, 4.51367e-18, -4.26993e-18, 0.699502, 0.566667, 1, -0.715401, 4.51369e-18, -4.26994e-18, 0.698714, 0.6, 1, -0.716178, 4.51369e-18, -4.26995e-18, 0.697918, 0.633333, 1, -0.716958, 4.51369e-18, -4.26995e-18, 0.697116, 0.733333, 1, -0.719267, 4.51367e-18, -4.26992e-18, 0.694734, 0.8, 1, -0.720739, 4.51362e-18, -4.26988e-18, 0.693206, 0.866667, 1, -0.722115, 4.51356e-18, -4.26982e-18, 0.691773, 0.933333, 1, -0.723357, 4.51349e-18, -4.26976e-18, 0.690474, 1, 1, -0.724446, 4.51342e-18, -4.26969e-18, 0.689331, 1.06667, 1, -0.725318, 4.51335e-18, -4.26963e-18, 0.688414, 1.16667, 1, -0.726204, 4.51327e-18, -4.26955e-18, 0.687479, 1.43333, 1, -0.725318, 0, 0, 0.688414, 1.5, 1, -0.724446, 0, 0, 0.689331, 1.6, 1, -0.722753, 0, 0, 0.691106, 1.66667, 1, -0.721445, 0, 0, 0.692472, 1.73333, 1, -0.720012, 0, 0, 0.693961, 1.76667, 1, -0.719267, 0, 0, 0.694734, 1.8, 1, -0.718508, 0, 0, 0.695519, 1.83333, 1, -0.717737, 0, 0, 0.696315, 1.86667, 1, -0.716958, 0, 0, 0.697116, 1.9, 1, -0.716178, 0, 0, 0.697918, 1.93333, 1, -0.715401, 0, 0, 0.698714, 1.96667, 1, -0.71463, 0, 0, 0.699502, 2.03333, 1, -0.713127, 0, 0, 0.701034, 2.1, 1, -0.711709, 0, 0, 0.702475, 2.16667, 1, -0.710399, 0, 0, 0.703799, 2.23333, 1, -0.709259, 0, 0, 0.704948, 2.3, 1, -0.7083, 0, 0, 0.705911, 2.36667, 1, -0.707572, 0, 0, 0.706641, 2.5, 1, -0.706937, 4.51325e-18, -4.26953e-18, 0.707277) -[sub_resource type="Animation" id="Animation_ylm5j"] +[sub_resource type="Animation" id="Animation_1cwks"] resource_name = "walk_backward_loop" length = 0.833333 loop_mode = 1 @@ -308,26 +453,26 @@ tracks/16/keys = PackedFloat32Array(0, 1, -0.787928, 0, 0, 0.615767, 0.0333333, tracks/17/type = "rotation_3d" tracks/17/imported = true tracks/17/enabled = true -tracks/17/path = NodePath("Skeleton/Skeleton3D:UpperBody") +tracks/17/path = NodePath("Skeleton/Skeleton3D:Wrist_L") tracks/17/interp = 1 tracks/17/loop_wrap = true -tracks/17/keys = PackedFloat32Array(0, 1, -0.0619498, 4.36274e-08, 2.70791e-09, 0.998079) +tracks/17/keys = PackedFloat32Array(0, 1, 5.1721e-09, 1.73886e-07, -0.0182467, 0.999834) tracks/18/type = "rotation_3d" tracks/18/imported = true tracks/18/enabled = true -tracks/18/path = NodePath("Skeleton/Skeleton3D:Wrist_L") +tracks/18/path = NodePath("Skeleton/Skeleton3D:Wrist_R") tracks/18/interp = 1 tracks/18/loop_wrap = true -tracks/18/keys = PackedFloat32Array(0, 1, 5.1721e-09, 1.73886e-07, -0.0182467, 0.999834) +tracks/18/keys = PackedFloat32Array(0, 1, 5.1721e-09, -1.73886e-07, 0.0182467, 0.999834) tracks/19/type = "rotation_3d" tracks/19/imported = true tracks/19/enabled = true -tracks/19/path = NodePath("Skeleton/Skeleton3D:Wrist_R") +tracks/19/path = NodePath("Skeleton/Skeleton3D:UpperBody") tracks/19/interp = 1 tracks/19/loop_wrap = true -tracks/19/keys = PackedFloat32Array(0, 1, 5.1721e-09, -1.73886e-07, 0.0182467, 0.999834) +tracks/19/keys = PackedFloat32Array(0, 1, -0.0619498, 4.36274e-08, 2.70791e-09, 0.998079) -[sub_resource type="Animation" id="Animation_mc0wh"] +[sub_resource type="Animation" id="Animation_ic4ky"] resource_name = "walk_forward_loop" length = 0.833333 loop_mode = 1 @@ -453,26 +598,26 @@ tracks/16/keys = PackedFloat32Array(0, 1, -0.703318, 0, 0, 0.710875, 0.0333333, tracks/17/type = "rotation_3d" tracks/17/imported = true tracks/17/enabled = true -tracks/17/path = NodePath("Skeleton/Skeleton3D:UpperBody") +tracks/17/path = NodePath("Skeleton/Skeleton3D:Wrist_L") tracks/17/interp = 1 tracks/17/loop_wrap = true -tracks/17/keys = PackedFloat32Array(0, 1, -0.0619498, 4.36274e-08, 2.70791e-09, 0.998079) +tracks/17/keys = PackedFloat32Array(0, 1, 5.1721e-09, 1.73886e-07, -0.0182467, 0.999834) tracks/18/type = "rotation_3d" tracks/18/imported = true tracks/18/enabled = true -tracks/18/path = NodePath("Skeleton/Skeleton3D:Wrist_L") +tracks/18/path = NodePath("Skeleton/Skeleton3D:Wrist_R") tracks/18/interp = 1 tracks/18/loop_wrap = true -tracks/18/keys = PackedFloat32Array(0, 1, 5.1721e-09, 1.73886e-07, -0.0182467, 0.999834) +tracks/18/keys = PackedFloat32Array(0, 1, 5.1721e-09, -1.73886e-07, 0.0182467, 0.999834) tracks/19/type = "rotation_3d" tracks/19/imported = true tracks/19/enabled = true -tracks/19/path = NodePath("Skeleton/Skeleton3D:Wrist_R") +tracks/19/path = NodePath("Skeleton/Skeleton3D:UpperBody") tracks/19/interp = 1 tracks/19/loop_wrap = true -tracks/19/keys = PackedFloat32Array(0, 1, 5.1721e-09, -1.73886e-07, 0.0182467, 0.999834) +tracks/19/keys = PackedFloat32Array(0, 1, -0.0619498, 4.36274e-08, 2.70791e-09, 0.998079) -[sub_resource type="Animation" id="Animation_kreh1"] +[sub_resource type="Animation" id="Animation_vyqbu"] resource_name = "walk_left_loop" length = 0.833333 loop_mode = 1 @@ -617,7 +762,7 @@ tracks/19/interp = 1 tracks/19/loop_wrap = true tracks/19/keys = PackedFloat32Array(0, 1, 5.1721e-09, -1.73886e-07, 0.0182467, 0.999834) -[sub_resource type="Animation" id="Animation_q7kt1"] +[sub_resource type="Animation" id="Animation_6qowt"] resource_name = "walk_right_loop" length = 0.833333 loop_mode = 1 @@ -762,18 +907,26 @@ tracks/19/interp = 1 tracks/19/loop_wrap = true tracks/19/keys = PackedFloat32Array(0, 1, 5.1721e-09, -1.73886e-07, 0.0182467, 0.999834) -[sub_resource type="AnimationLibrary" id="AnimationLibrary_bvwgj"] +[sub_resource type="AnimationLibrary" id="AnimationLibrary_2km5j"] _data = { -"idle": SubResource("Animation_5wsog"), -"walk_backward": SubResource("Animation_ylm5j"), -"walk_forward": SubResource("Animation_mc0wh"), -"walk_left": SubResource("Animation_kreh1"), -"walk_right": SubResource("Animation_q7kt1") +"hold": SubResource("Animation_ptf2s"), +"idle": SubResource("Animation_0g7nm"), +"walk_backward": SubResource("Animation_1cwks"), +"walk_forward": SubResource("Animation_ic4ky"), +"walk_left": SubResource("Animation_vyqbu"), +"walk_right": SubResource("Animation_6qowt") } +[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_v7y1g"] +animation = &"hold" + [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ra5r1"] animation = &"idle" +[sub_resource type="AnimationNodeBlend2" id="AnimationNodeBlend2_10xtt"] +filter_enabled = true +filters = ["Skeleton/Skeleton3D:LowerArm_L", "Skeleton/Skeleton3D:LowerArm_R", "Skeleton/Skeleton3D:UpperArm_L", "Skeleton/Skeleton3D:UpperArm_R", "Skeleton/Skeleton3D:Wrist_L", "Skeleton/Skeleton3D:Wrist_R"] + [sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_cun17"] animation = &"idle" @@ -805,11 +958,16 @@ input_1/auto_advance = false input_1/reset = true [sub_resource type="AnimationNodeBlendTree" id="AnimationNodeBlendTree_cstk8"] -nodes/Animation/node = SubResource("AnimationNodeAnimation_ra5r1") -nodes/Animation/position = Vector2(600, 60) +graph_offset = Vector2(289.198, 97.2975) +nodes/hold/node = SubResource("AnimationNodeAnimation_v7y1g") +nodes/hold/position = Vector2(800, 340) +nodes/idle/node = SubResource("AnimationNodeAnimation_ra5r1") +nodes/idle/position = Vector2(600, 60) +nodes/is_holding/node = SubResource("AnimationNodeBlend2_10xtt") +nodes/is_holding/position = Vector2(1000, 200) nodes/not_moving/node = SubResource("AnimationNodeAnimation_cun17") nodes/not_moving/position = Vector2(400, 60) -nodes/output/position = Vector2(960, 180) +nodes/output/position = Vector2(1180, 260) nodes/walk_backward/node = SubResource("AnimationNodeAnimation_c1sen") nodes/walk_backward/position = Vector2(200, 300) nodes/walk_direction/node = SubResource("AnimationNodeTransition_j7sk1") @@ -820,7 +978,7 @@ nodes/walk_speed/node = SubResource("AnimationNodeBlend2_krc6q") nodes/walk_speed/position = Vector2(600, 200) nodes/walk_state/node = SubResource("AnimationNodeTransition_nyobm") nodes/walk_state/position = Vector2(800, 120) -node_connections = [&"output", 0, &"walk_state", &"walk_direction", 0, &"walk_forward", &"walk_direction", 1, &"walk_backward", &"walk_speed", 0, &"not_moving", &"walk_speed", 1, &"walk_direction", &"walk_state", 0, &"Animation", &"walk_state", 1, &"walk_speed"] +node_connections = [&"is_holding", 0, &"walk_state", &"is_holding", 1, &"hold", &"output", 0, &"is_holding", &"walk_direction", 0, &"walk_forward", &"walk_direction", 1, &"walk_backward", &"walk_speed", 0, &"not_moving", &"walk_speed", 1, &"walk_direction", &"walk_state", 0, &"idle", &"walk_state", 1, &"walk_speed"] [node name="Player" type="CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.75, 0) @@ -861,16 +1019,17 @@ Skeleton = NodePath("../Model/Skeleton/Skeleton3D") active = false root_node = NodePath("../../Model") libraries = { -"": SubResource("AnimationLibrary_bvwgj") +"": SubResource("AnimationLibrary_2km5j") } tree_root = SubResource("AnimationNodeBlendTree_cstk8") anim_player = NodePath("../../Model/AnimationPlayer") +parameters/is_holding/blend_amount = 0.0 parameters/walk_direction/current_state = "forward" parameters/walk_direction/transition_request = "" parameters/walk_direction/current_index = 0 parameters/walk_speed/blend_amount = 0.0 parameters/walk_state/current_state = "idle" -parameters/walk_state/transition_request = "idle" +parameters/walk_state/transition_request = "" parameters/walk_state/current_index = 0 [node name="Root" type="BoneAttachment3D" parent="AnimationController"] @@ -920,6 +1079,20 @@ bone_idx = 7 use_external_skeleton = true external_skeleton = NodePath("../../../../../Model/Skeleton/Skeleton3D") +[node name="LowerArm_L" type="BoneAttachment3D" parent="AnimationController/Root/LowerBody/UpperBody/UpperArm_L"] +transform = Transform3D(0.999306, 0.0372507, 2.71155e-07, -0.0372507, 0.999306, -3.32672e-09, -2.66575e-07, -3.54041e-09, 1, 0, 0.193644, 0) +bone_name = "LowerArm_L" +bone_idx = 8 +use_external_skeleton = true +external_skeleton = NodePath("../../../../../../Model/Skeleton/Skeleton3D") + +[node name="Wrist_L" type="BoneAttachment3D" parent="AnimationController/Root/LowerBody/UpperBody/UpperArm_L/LowerArm_L"] +transform = Transform3D(0.999334, 0.0364873, 3.47525e-07, -0.0364873, 0.999334, -1.66881e-08, -3.47903e-07, 3.9968e-09, 1, 1.19209e-07, 0.187995, -1.86265e-09) +bone_name = "Wrist_L" +bone_idx = 9 +use_external_skeleton = true +external_skeleton = NodePath("../../../../../../../Model/Skeleton/Skeleton3D") + [node name="UpperArm_R" type="BoneAttachment3D" parent="AnimationController/Root/LowerBody/UpperBody"] transform = Transform3D(-0.572005, -0.82025, -9.68575e-08, 0.819341, -0.571371, -0.0470728, 0.0386114, -0.026926, 0.998891, -0.0873834, 0.213866, -0.00179176) bone_name = "UpperArm_R" @@ -927,6 +1100,21 @@ bone_idx = 14 use_external_skeleton = true external_skeleton = NodePath("../../../../../Model/Skeleton/Skeleton3D") +[node name="LowerArm_R" type="BoneAttachment3D" parent="AnimationController/Root/LowerBody/UpperBody/UpperArm_R"] +transform = Transform3D(0.999306, -0.0372507, -2.71155e-07, 0.0372507, 0.999306, -3.3267e-09, 2.69728e-07, -3.66446e-09, 1, 0, 0.193644, 1.86265e-09) +bone_name = "LowerArm_R" +bone_idx = 15 +use_external_skeleton = true +external_skeleton = NodePath("../../../../../../Model/Skeleton/Skeleton3D") + +[node name="Wrist_R" type="BoneAttachment3D" parent="AnimationController/Root/LowerBody/UpperBody/UpperArm_R/LowerArm_R"] +transform = Transform3D(0.999334, -0.0364873, -3.47525e-07, 0.0364873, 0.999334, -1.66882e-08, 3.47903e-07, 3.99677e-09, 1, -1.19209e-07, 0.187995, -1.86265e-09) +bone_name = "Wrist_R" +bone_idx = 16 +use_external_skeleton = true +external_skeleton = NodePath("../../../../../../../Model/Skeleton/Skeleton3D") + [node name="PickupController" type="Node3D" parent="." node_paths=PackedStringArray("Camera")] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.35, -0.45) script = ExtResource("2_ns2pe") Camera = NodePath("../AnimationController/Root/LowerBody/UpperBody/Neck/Head/Camera") diff --git a/ui/menu.tscn b/ui/menu.tscn index 675d9e1..9756bd9 100644 --- a/ui/menu.tscn +++ b/ui/menu.tscn @@ -20,6 +20,7 @@ font_color = Color(0.75, 0.75, 0.75, 1) [sub_resource type="SystemFont" id="SystemFont_y3lqx"] font_names = PackedStringArray("Monospace") +subpixel_positioning = 0 [sub_resource type="LabelSettings" id="LabelSettings_b1gi8"] font = SubResource("SystemFont_y3lqx")