diff --git a/authoring/greyboxing/city.blend b/authoring/greyboxing/city.blend index 45606ea2..977c8948 100644 Binary files a/authoring/greyboxing/city.blend and b/authoring/greyboxing/city.blend differ diff --git a/authoring/greyboxing/city.blend1 b/authoring/greyboxing/city.blend1 index fa24e6c6..45606ea2 100644 Binary files a/authoring/greyboxing/city.blend1 and b/authoring/greyboxing/city.blend1 differ diff --git a/player_controller/Scripts/PlayerController.cs b/player_controller/Scripts/PlayerController.cs index 7b878a85..41d5da30 100644 --- a/player_controller/Scripts/PlayerController.cs +++ b/player_controller/Scripts/PlayerController.cs @@ -823,6 +823,8 @@ public partial class PlayerController : CharacterBody3D _playerState.SendEvent(resultingEvent); } + private Vector3 _preDashVelocity = Vector3.Zero; + public void OnAimedDashStarted() { // Adjusting for player height, where the middle of the capsule should get to the dash location instead of the @@ -830,6 +832,9 @@ public partial class PlayerController : CharacterBody3D var correction = DashSystem.CollisionNormal == Vector3.Down ? _playerHeight : DashSystem.DashCastRadius; var correctedLocation = DashSystem.PlannedLocation + Vector3.Down * correction; + _preDashVelocity = Velocity; + _dashDirection = (correctedLocation - GlobalPosition).Normalized(); + var dashTween = CreatePositionTween(correctedLocation, AimedDashTime); // dashTween.TweenMethod(Callable.From(AimedDashTweenOngoing), 0.0f, 1.0f, AimedDashTime); dashTween.Finished += AimedDashTweenEnded; @@ -880,6 +885,9 @@ public partial class PlayerController : CharacterBody3D public void OnAimedDashFinished() { + var postDashVelocity = _preDashVelocity.Length() > PostDashSpeed ? PostDashSpeed : _preDashVelocity.Length(); + Velocity = _dashDirection * postDashVelocity; + if (_shouldMantleOnDashEnded) MantleToLocation(_mantleLocation); } @@ -922,8 +930,8 @@ public partial class PlayerController : CharacterBody3D public void OnPoweredDashFinished() { // Try mantling but don't know if this is useful - if (CanMantle()) - MantleToLocation(MantleSystem.FindMantleForHeadRotation(HeadSystem.Rotation.Y).Unwrap()); + // if (CanMantle()) + // MantleToLocation(MantleSystem.FindMantleForHeadRotation(HeadSystem.Rotation.Y).Unwrap()); } public void FinishPoweredDash() @@ -967,13 +975,17 @@ public partial class PlayerController : CharacterBody3D var mantleLocationResult = MantleSystem.FindMantleForHeadRotation(HeadSystem.Rotation.Y); return mantleLocationResult.IsSome(out _); } + + private Vector3 _preMantleVelocity = Vector3.Zero; public void MantleToLocation(Vector3 location) { + _preMantleVelocity = Velocity; var mantleTween = CreatePositionTween(location, MantleTime); mantleTween.Finished += MantleFinished; } public void MantleFinished() { + Velocity = _preMantleVelocity; _playerState.SendEvent("grounded"); } diff --git a/systems/mantle/MantleSystem.cs b/systems/mantle/MantleSystem.cs index 2c34fe5a..9b584579 100644 --- a/systems/mantle/MantleSystem.cs +++ b/systems/mantle/MantleSystem.cs @@ -15,8 +15,6 @@ public partial class MantleSystem: Node3D private ShapeCast3D _wallInFrontCast3D; private ShapeCast3D _mantleCast3D; private RayCast3D _mantleCheckCast3D; - - private Option _mantleLocation; public void Init() {