Skip to content

Commit

Permalink
Support line of sight with different masks.
Browse files Browse the repository at this point in the history
  • Loading branch information
isadorasophia committed Oct 6, 2024
1 parent 09dd1aa commit 16d6a28
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Murder/Services/PhysicsServices.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,16 +203,21 @@ public static bool RaycastTiles(World world, Vector2 startPosition, Vector2 endP
return false;
}

public static bool HasLineOfSight(World world, Vector2 from, Vector2 to)
public static bool HasLineOfSight(World world, Vector2 from, Vector2 to, int mask)
{
if (Raycast(world, from, to, CollisionLayersBase.BLOCK_VISION, [], out RaycastHit hit))
if (Raycast(world, from, to, mask, [], out RaycastHit hit))
{
return false;
}

return true;
}

public static bool HasLineOfSight(World world, Vector2 from, Vector2 to)
{
return HasLineOfSight(world, from, to, CollisionLayersBase.BLOCK_VISION);
}

/// <summary>
/// Returns whether <paramref name="from"/> an see an entity <paramref name="targetEntityId"/> before
/// it gets to <paramref name="to"/>.
Expand Down

0 comments on commit 16d6a28

Please sign in to comment.