Skip to content

Commit

Permalink
fix IsAreaFree
Browse files Browse the repository at this point in the history
  • Loading branch information
danilwhale committed Aug 8, 2024
1 parent 2bb2b6e commit b349609
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion SharpCraft/Entities/EntitySystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,14 @@ public void Draw(float lastPartTicks, Frustum frustum, RenderLayer layer)

public bool IsAreaFree(BoundingBox box)
{
return !_entities.Any(e => CheckCollisionBoxes(e.Box, box));
return !_entities.Any(e =>
{
if (!(box.Max.X > e.Box.Min.X && box.Min.X < e.Box.Max.X)) return false;
if (!(box.Max.Y > e.Box.Min.Y && box.Min.Y < e.Box.Max.Y)) return false;
if (!(box.Max.Z > e.Box.Min.Z && box.Min.Z < e.Box.Max.Z)) return false;

return true;
});
}

public void Dispose()
Expand Down

0 comments on commit b349609

Please sign in to comment.