fix: dash indicator vfx works
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 7s
Create tag and build when new code gets to main / Export (push) Successful in 3m41s

This commit is contained in:
2025-07-06 22:18:59 +02:00
parent e4880d42f9
commit e3d10840c9
7 changed files with 159 additions and 15 deletions

View File

@ -5,7 +5,7 @@ namespace Movementtests.systems;
public partial class DashSystem: Node3D
{
[Export(PropertyHint.Range, "0,0.2,0.01,or_greater")]
public float DashSpeed { get; set; } = 0.05f;
public float DashSpeed { get; set; } = 0.1f;
[Export(PropertyHint.Range, "0,1000,1,or_greater")]
public float PostDashSpeed { get; set; } = 0f;
@ -27,7 +27,11 @@ public partial class DashSystem: Node3D
private MantleSystem _mantleSystem;
private MeshInstance3D _dashTarget;
private CpuParticles3D _dashIndicator;
private AnimationPlayer _dashIndicatorAnim;
[Export]
public PackedScene DashIndicatorScene { get; set; }
[Signal]
public delegate void DashStartedEventHandler();
@ -48,6 +52,8 @@ public partial class DashSystem: Node3D
_dashTarget = GetNode<MeshInstance3D>("DashTarget");
_dashTarget.SetVisible(false);
_dashIndicator = GetNode<CpuParticles3D>("DashIndicator");
_dashIndicatorAnim = GetNode<AnimationPlayer>("DashIndicator/AnimationPlayer");
}
private void ComputeDashLocation()
@ -66,11 +72,16 @@ public partial class DashSystem: Node3D
var fraction = _dashCast3D.GetClosestCollisionSafeFraction();
var globalSweepPath = TargetLocation - _dashCast3D.GlobalPosition;
var locationAlongPath = _dashCast3D.GlobalPosition + globalSweepPath * fraction;
// Pushes the point down when dashing to under a platform so head doesn't clip
var maxPushDownDistance = 0.9f;
var correctionProportion = (float) Mathf.Remap(CollisionNormal.Y, -0.5, -1, 0, 1);
var proportion = (float) Mathf.Remap(_dashCast3D.GlobalRotation.X, 0, 1.57, 0, 1);
PlannedPlayerLocation = locationAlongPath + CollisionNormal * maxPushDownDistance * proportion * correctionProportion;
PlannedPlayerLocation = locationAlongPath
+ CollisionNormal
* maxPushDownDistance
* Mathf.Clamp(proportion, 0, 1)
* Mathf.Clamp(correctionProportion, 0, 1);
}
public void PrepareDash()
@ -88,7 +99,7 @@ public partial class DashSystem: Node3D
var mantleLocation = Vector3.Zero;
if (HasHit && Mathf.Abs(CollisionNormal.Y) < 0.5f)
{
var mantleResult = _mantleSystem.FindMantleLocationAtPoint(CollisionPoint, CollisionNormal);
var mantleResult = _mantleSystem.FindMantleLocationAtPoint(PlannedPlayerLocation, CollisionNormal);
ShouldMantle = mantleResult.IsSome(out mantleLocation);
}
PlannedMantleLocation = mantleLocation;
@ -116,13 +127,19 @@ public partial class DashSystem: Node3D
{
EmitSignal(SignalName.DashStarted);
_dashTarget.SetVisible(false);
var dashTweenInputs = new TweenQueueSystem.TweenInputs(PlannedPlayerLocation, 0.1f);
var dashTweenInputs = new TweenQueueSystem.TweenInputs(PlannedPlayerLocation, DashSpeed);
var dashTween = _tweenQueueSystem.TweenToLocation(dashTweenInputs);
dashTween.Finished += DashTweenEnded;
if (ShouldMantle)
{
_tweenQueueSystem.QueueTween(PlannedMantleLocation, 0.2f);
return;
}
var dashIndicator = (CpuParticles3D) DashIndicatorScene.Instantiate();
GetTree().GetRoot().AddChild(dashIndicator);
dashIndicator.GlobalPosition = _dashTarget.GlobalPosition;
dashIndicator.SetEmitting(true);
}
public void DashToThrownWeapon()