Skip to content

Commit 001f63f

Browse files
authored
fix: Fixed wrong code in physics queries overlap (#505)
* Fixed wrong code * Changed stack to span
1 parent f5c0828 commit 001f63f

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

en/manual/physics/physics-queries/overlaps.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,12 @@ public bool CheckGrounded(BodyComponent body)
105105
// Checking every layer except the one the player is on
106106
var mask = ~body.CollisionLayer.ToMask();
107107

108-
Stack<CollidableStack> buffer = stackalloc CollidableStack[1];
108+
Span<CollidableStack> buffer = stackalloc CollidableStack[1];
109109

110110
// If there are any collisions under the player, the player is on the ground
111-
return sim.Overlap(sphere, pose, buffer, mask).Any();
111+
foreach (var item in sim.Overlap(sphere, pose, buffer, mask))
112+
return true;
113+
114+
return false;
112115
}
113116
```

0 commit comments

Comments
 (0)