public void UpdateStraightPath(Vector2 fromPos, Vector2 toPos) { _pathEndReached = false; _currentT = 0f; var result = GetViewport().GetWorld2d().DirectSpaceState.Raycast(fromPos, toPos, null, 1 << 0); Curve = GameZone.GetPathCurve(fromPos, result?.Position ?? toPos, 0f); }
public void UpdatePathToPlayer() { _pathEndReached = false; var player = GetTree().GetFirstNodeInGroup <Player>(Player.GROUP); if (player != null) { Curve = GameZone.GetPathCurve(_owner.GlobalPosition, player.GlobalPosition, 10f); _currentT = 0f; } }