Rough collision avoidance implementation using pre-generated floors (just floor 01)
This commit is contained in:
@@ -19,7 +19,6 @@ public partial class BossLogic
|
||||
var boss = Get<IBoss>();
|
||||
var player = Get<IPlayer>();
|
||||
var delta = (float)input.Delta;
|
||||
var playerPosition = new Vector3(player.CurrentPosition.X, boss.GlobalPosition.Y, player.CurrentPosition.Z);
|
||||
var targetDirection = boss.GlobalPosition - player.CurrentPosition;
|
||||
boss.GlobalRotation = new Vector3(boss.GlobalRotation.X, Mathf.LerpAngle(boss.GlobalRotation.Y, Mathf.Atan2(-targetDirection.X, -targetDirection.Z), delta * 3f), boss.GlobalRotation.Z);
|
||||
if (boss.GlobalPosition.DistanceTo(player.CurrentPosition) > 5.0f)
|
||||
|
||||
@@ -11,11 +11,10 @@ public partial class BossLogic
|
||||
{
|
||||
public Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var delta = input.Delta;
|
||||
var enemy = Get<IEnemy>();
|
||||
var player = Get<IPlayer>();
|
||||
var target = player.CurrentPosition;
|
||||
enemy.MoveToLocation(target, (float)delta);
|
||||
enemy.SetTarget(target);
|
||||
return ToSelf();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user