Better free movement

This commit is contained in:
Marco 2025-02-18 18:18:13 +01:00
commit 388747ccb3
7 changed files with 108 additions and 15 deletions

View file

@ -27,7 +27,19 @@ public partial class ActorFreeMovement : MovementHandler
public override void Move(double delta)
{
MovementDirection = AggregateInputProviders();
MovementDirection = AggregateInputProviders().Normalized();
var aimingDirection = GetAimingDirection().Normalized();
var isStrafing = GetStrafing();
if (!isStrafing && aimingDirection.Length() > 0.1f)
{
FacingDirection = aimingDirection;
}
else if (MovementDirection != Vector2.Zero)
{
FacingDirection = MovementDirection;
}
_parent.Velocity = MovementDirection * _parent.MovementSpeed;