From 6d967bf2bf8f185bd966b5d9648adde072f0d7eb Mon Sep 17 00:00:00 2001 From: Minimata Date: Fri, 6 Feb 2026 12:10:21 +0100 Subject: [PATCH] extended enemy dashthrough improvement to aimed dash behaviour --- .../scripts/PlayerController.cs | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/scenes/player_controller/scripts/PlayerController.cs b/scenes/player_controller/scripts/PlayerController.cs index 8482d1cb..627e8050 100644 --- a/scenes/player_controller/scripts/PlayerController.cs +++ b/scenes/player_controller/scripts/PlayerController.cs @@ -1782,20 +1782,32 @@ public partial class PlayerController : CharacterBody3D, // feet of the capsule var correction = DashSystem.CollisionNormal == Vector3.Down ? _playerHeight : DashSystem.DashCastRadius; var correctedLocation = DashSystem.PlannedLocation + Vector3.Down * correction; - + var travel = correctedLocation - GlobalPosition; + _dashDirection = travel.Normalized(); + + var shouldRebound = false; if (DashSystem.CanDashThroughTarget && DashSystem.CollidedObject is ITargetable targetable) - correctedLocation = ComputePositionAfterTargetedDash(targetable.GetTargetGlobalPosition(), DashSystem.CollisionPoint); + { + var plannedDashLocation = targetable.GetTargetGlobalPosition() + Vector3.Down*_playerHeight/2; + travel = plannedDashLocation - GlobalPosition; + _dashDirection = travel.Normalized(); + var postDashLocation = plannedDashLocation + _dashDirection; + var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask); + var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery); + shouldRebound = wallBehindResult.Count > 0; + correctedLocation = shouldRebound ? plannedDashLocation : postDashLocation; + } // Start invincibility timer for the duration of the dash and a bit more afterwards OnHitInvincibility(); _preDashVelocity = Velocity; - _dashDirection = (correctedLocation - GlobalPosition).Normalized(); SetupDashDamageDetector(correctedLocation); var dashTween = CreatePositionTween(correctedLocation, AimedDashTime); // dashTween.TweenMethod(Callable.From(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime); dashTween.Finished += AimedDashTweenEnded; + if (shouldRebound) dashTween.Finished += ManualKnockback; _customMantle = DashSystem.ShouldMantle; _customMantleCurve = DashSystem.MantleSystem.MantleCurve; @@ -2112,7 +2124,7 @@ public partial class PlayerController : CharacterBody3D, var travel = plannedDashLocation - GlobalPosition; _dashDirection = travel.Normalized(); - var postDashLocation = plannedDashLocation + 0.5f*travel; + var postDashLocation = plannedDashLocation + _dashDirection; var wallBehindQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition + Vector3.Up*HeadSystem.Position.Y, postDashLocation, GroundDetector.CollisionMask); var wallBehindResult = _spaceState.IntersectRay(wallBehindQuery); var shouldRebound = wallBehindResult.Count > 0; @@ -2122,6 +2134,7 @@ public partial class PlayerController : CharacterBody3D, if (isParry || shouldRebound) dashTween.Finished += OnDashParryEnded; else dashTween.Finished += OnDashAttackEnded; } + public void OnDashAttackStarted() { StartDashAction(isParry: false); @@ -2156,6 +2169,11 @@ public partial class PlayerController : CharacterBody3D, public void OnDashParryEnded() { StopDashAction(); + ManualKnockback(); + } + + public void ManualKnockback() + { Velocity = -_dashDirection*RKnockback.Modifier; }