getPathToPosition method

List<Vector2> getPathToPosition(
  1. Vector2 position, {
  2. List<GameComponent>? ignoreCollisions,
})

Returns the path to position without moving the component.

Implementation

List<Vector2> getPathToPosition(
  Vector2 position, {
  List<GameComponent>? ignoreCollisions,
}) {
  _ignoreCollisions.clear();
  _ignoreCollisions.addAll(_comp.shapeHitboxes);

  ignoreCollisions?.forEach(
    (item) => _ignoreCollisions.addAll(item.shapeHitboxes),
  );
  return _calculatePath(position);
}