Skip to content

Commit

Permalink
fix: callback in separate body even if trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Prozi committed Sep 14, 2024
1 parent 0f9ea6b commit 015301f
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dist/demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4031,7 +4031,7 @@ which is good. See: http://baagoe.com/en/RandomMusings/hash/avalanche.xhtml
const offsets = { x: 0, y: 0 };
const addOffsets = (collision) => {
// when is not trigger and callback returns true it continues
if (!collision.b.isTrigger && callback(collision)) {
if (callback(collision) && !collision.b.isTrigger) {
offsets.x += collision.overlapV.x;
offsets.y += collision.overlapV.y;
}
Expand Down
2 changes: 1 addition & 1 deletion dist/system.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class System extends base_system_1.BaseSystem {
const offsets = { x: 0, y: 0 };
const addOffsets = (collision) => {
// when is not trigger and callback returns true it continues
if (!collision.b.isTrigger && callback(collision)) {
if (callback(collision) && !collision.b.isTrigger) {
offsets.x += collision.overlapV.x;
offsets.y += collision.overlapV.y;
}
Expand Down
2 changes: 1 addition & 1 deletion docs/demo/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -4031,7 +4031,7 @@ which is good. See: http://baagoe.com/en/RandomMusings/hash/avalanche.xhtml
const offsets = { x: 0, y: 0 };
const addOffsets = (collision) => {
// when is not trigger and callback returns true it continues
if (!collision.b.isTrigger && callback(collision)) {
if (callback(collision) && !collision.b.isTrigger) {
offsets.x += collision.overlapV.x;
offsets.y += collision.overlapV.y;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "detect-collisions",
"version": "9.15.0",
"version": "9.15.1",
"description": "Detect collisions between different shapes such as Points, Lines, Boxes, Polygons (including concave), Ellipses, and Circles. Features include RayCasting and support for offsets, rotation, scaling, bounding box padding, with options for static and trigger bodies (non-colliding).",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export class System<TBody extends Body = Body> extends BaseSystem<TBody> {
const offsets = { x: 0, y: 0 };
const addOffsets = (collision: Response) => {
// when is not trigger and callback returns true it continues
if (!collision.b.isTrigger && callback(collision)) {
if (callback(collision) && !collision.b.isTrigger) {
offsets.x += collision.overlapV.x;
offsets.y += collision.overlapV.y;
}
Expand Down

0 comments on commit 015301f

Please sign in to comment.