Skip to content

Commit 274583e

Browse files
abcxffCopilot
andauthored
Update src/Physics/HashGrid.ts
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent a40c5fe commit 274583e

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/Physics/HashGrid.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export default class HashGrid implements CollisionManager {
218218
const [entA, entB] = eidA < eidB ? [entityA, entityB] : [entityB, entityA];
219219

220220
// Triangular matrix index: row * (row - 1) / 2 + col, where row > col
221-
const triangularIndex = (idB * (idB - 1) / 2 + idA);
221+
const triangularIndex = Math.floor(idB * (idB - 1) / 2) + idA;
222222
const arrayIndex = triangularIndex >>> 5;
223223
const bitIndex = triangularIndex & 31;
224224
const bitMask = 1 << bitIndex;

0 commit comments

Comments
 (0)