Skip to content

Commit

Permalink
fix: collision crash, guard invalid separation
Browse files Browse the repository at this point in the history
  • Loading branch information
eonarheim committed Dec 18, 2024
1 parent 31305c5 commit 3277026
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).

### Fixed

-
- Fixed CollidePolygonPolygon crash with some defense against invalid separation

### Updates

Expand Down
4 changes: 4 additions & 0 deletions src/engine/Collision/Colliders/CollisionJumpTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ export const CollisionJumpTable = {
}
}

if (!separation.localSide || !separation.localAxis || !separation.axis) {
return [];
}

// Clip incident side by the perpendicular lines at each end of the reference side
// https://en.wikipedia.org/wiki/Sutherland%E2%80%93Hodgman_algorithm
const referenceSide = separation.localSide.transform(toIncidentFrame);
Expand Down

0 comments on commit 3277026

Please sign in to comment.