mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 14:53:47 +00:00
Better free movement
This commit is contained in:
parent
90d2a95fa8
commit
388747ccb3
7 changed files with 108 additions and 15 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue