Not perfect but enemies move/attack with animation

This commit is contained in:
2024-09-15 23:56:05 -07:00
parent 4a1fdd94f8
commit 8143da44db
36 changed files with 891 additions and 507 deletions

View File

@@ -20,8 +20,8 @@ public partial class EnemyLogic
var delta = input.Delta;
var enemy = Get<IEnemy>();
var targetPosition = enemy.NavAgent.GetNextPathPosition();
enemy.Velocity = (targetPosition - enemy.GlobalTransform.Origin).Normalized() * 3.0f;
var velocity = (targetPosition - enemy.GlobalPosition).Normalized() * 3.0f;
enemy.Velocity = velocity;
enemy.Rotation = new Vector3(0, (float)Mathf.LerpAngle(enemy.Rotation.Y, Mathf.Atan2(enemy.Velocity.X, enemy.Velocity.Z), delta * 10.0), 0);
Output(new Output.MovementComputed());