From 5e2b8de2d358b8b90668e2d9308de2b5b029980a Mon Sep 17 00:00:00 2001 From: cosmonaut Date: Wed, 6 Apr 2022 20:25:46 -0700 Subject: [PATCH] Spatial Hash Retrieve returns collision groups --- src/Collision/SpatialHash2D.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Collision/SpatialHash2D.cs b/src/Collision/SpatialHash2D.cs index 581751dd..d9748e57 100644 --- a/src/Collision/SpatialHash2D.cs +++ b/src/Collision/SpatialHash2D.cs @@ -68,7 +68,7 @@ namespace MoonWorks.Collision /// /// Retrieves all the potential collisions of a shape-transform pair. Excludes any shape-transforms with the given ID. /// - public IEnumerable<(T, IHasAABB2D, Transform2D)> Retrieve(T id, IHasAABB2D shape, Transform2D transform2D, uint collisionMask = uint.MaxValue) + public IEnumerable<(T, IHasAABB2D, Transform2D, uint)> Retrieve(T id, IHasAABB2D shape, Transform2D transform2D, uint collisionMask = uint.MaxValue) { var returned = AcquireHashSet(); @@ -96,7 +96,7 @@ namespace MoonWorks.Collision if (!id.Equals(t) && ((collisionGroups & collisionMask) > 0) && AABB2D.TestOverlap(box, otherShape.TransformedAABB(otherTransform))) { returned.Add(t); - yield return (t, otherShape, otherTransform); + yield return (t, otherShape, otherTransform, collisionGroups); } } } @@ -113,7 +113,7 @@ namespace MoonWorks.Collision /// /// A transformed AABB. /// - public IEnumerable<(T, IHasAABB2D, Transform2D)> Retrieve(AABB2D aabb, uint collisionMask = uint.MaxValue) + public IEnumerable<(T, IHasAABB2D, Transform2D, uint)> Retrieve(AABB2D aabb, uint collisionMask = uint.MaxValue) { var returned = AcquireHashSet(); @@ -139,7 +139,7 @@ namespace MoonWorks.Collision var (otherShape, otherTransform, collisionGroups) = IDLookup[t]; if (((collisionGroups & collisionMask) > 0) && AABB2D.TestOverlap(aabb, otherShape.TransformedAABB(otherTransform))) { - yield return (t, otherShape, otherTransform); + yield return (t, otherShape, otherTransform, collisionGroups); } } }