Determine if there is a clear line of sight between two positions. Limited to room geometry. Objects are ignored. @function HasLineOfSight @tparam float roomID Room ID of the first position's room. @tparam Vec3 posA First position. @tparam Vec3 posB Second position. @treturn bool true if there is a line of sight, false if not. @usage local flamePlinthPos = flamePlinth:GetPosition() + Vec3(0, flame
| 45 | // local test = TEN.Util.HasLineOfSight(enemyHead:GetRoomNumber(), enemyHead:GetPosition(), flamePlinthPos); |
| 46 | // print(tostring(test)) |
| 47 | static bool HasLineOfSight(int roomID, const Vec3& posA, const Vec3& posB) |
| 48 | { |
| 49 | auto vector0 = posA.ToGameVector(); |
| 50 | auto vector1 = posB.ToGameVector(); |
| 51 | |
| 52 | StaticMesh* mesh = nullptr; |
| 53 | auto vector = Vector3i::Zero; |
| 54 | return (LOS(&vector0, &vector1) && ObjectOnLOS2(&vector0, &vector1, &vector, &mesh) == NO_LOS_ITEM); |
| 55 | } |
| 56 | |
| 57 | /// Calculate the horizontal distance between two positions. |
| 58 | // @function CalculateHorizontalDistance |
nothing calls this directly
no test coverage detected