From 16d6a28a2da36258e87c52ace44dc8574ab2bb77 Mon Sep 17 00:00:00 2001 From: bonnibel Date: Sun, 6 Oct 2024 11:13:59 -0700 Subject: [PATCH] Support line of sight with different masks. --- src/Murder/Services/PhysicsServices.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Murder/Services/PhysicsServices.cs b/src/Murder/Services/PhysicsServices.cs index b43bbedb..178841fa 100644 --- a/src/Murder/Services/PhysicsServices.cs +++ b/src/Murder/Services/PhysicsServices.cs @@ -203,9 +203,9 @@ 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; } @@ -213,6 +213,11 @@ public static bool HasLineOfSight(World world, Vector2 from, Vector2 to) return true; } + public static bool HasLineOfSight(World world, Vector2 from, Vector2 to) + { + return HasLineOfSight(world, from, to, CollisionLayersBase.BLOCK_VISION); + } + /// /// Returns whether an see an entity before /// it gets to .