stunnable targets on hit

This commit is contained in:
2026-05-15 15:29:24 +02:00
parent a0e99a959f
commit afa335e7bf
19 changed files with 200 additions and 60 deletions

View File

@@ -21,6 +21,8 @@ public partial class CFlyingMovement : Node3D, IMoveable
public Vector3 ComputeVelocity(MovementInputs inputs)
{
if (inputs.IsStunned) return inputs.Velocity.Lerp(Vector3.Zero, (float) inputs.Delta * RMovement.Acceleration);
var velocity = inputs.Velocity;
var spaceState = GetWorld3D().DirectSpaceState;
var target = inputs.TargetLocation;
@@ -28,7 +30,7 @@ public partial class CFlyingMovement : Node3D, IMoveable
// Check if we have a direct line of sight to the player
if (!_movingToDesiredHeight)
{
velocity = velocity.Lerp(direction * RMovement.Speed, (float) inputs.delta * RMovement.Acceleration);
velocity = velocity.Lerp(direction * RMovement.Speed, (float) inputs.Delta * RMovement.Acceleration);
var query = PhysicsRayQueryParameters3D.Create(GlobalPosition, target, TerrainCollision);
var result = spaceState.IntersectRay(query);
@@ -40,7 +42,7 @@ public partial class CFlyingMovement : Node3D, IMoveable
}
else
{
velocity = velocity.Lerp(_randomDirection * RMovement.Speed, (float) inputs.delta * RMovement.Acceleration);
velocity = velocity.Lerp(_randomDirection * RMovement.Speed, (float) inputs.Delta * RMovement.Acceleration);
var groundQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition, GlobalPosition+Vector3.Down*RMovement.TargetHeight, TerrainCollision);
var groundResult = spaceState.IntersectRay(groundQuery);