X-Git-Url: https://git.r.bdr.sh/rbdr/sumo/blobdiff_plain/3100e0533cb89a185ea021dfb83c4f364750180f..refs/heads/rbdr-bouncy-walls:/lib/systems/detect_points_collision.js?ds=sidebyside diff --git a/lib/systems/detect_points_collision.js b/lib/systems/detect_points_collision.js index c84f3fc..7b44ebd 100644 --- a/lib/systems/detect_points_collision.js +++ b/lib/systems/detect_points_collision.js @@ -1,5 +1,5 @@ import { System } from '@serpentity/serpentity'; -import { SAT } from 'matter-js'; +import { Collision } from 'matter-js'; import BodyComponent from '../components/body'; import PointsColliderNode from '../nodes/points_collider'; @@ -84,8 +84,8 @@ export default class DetectPointsCollisionSystem extends System { const pointsTarget = collider.pointsCollider.pointsTarget; if (collisionTargetBody) { - const collision = SAT.collides(collider.body.body, collisionTargetBody.body); - if (collision.collided) { + const collision = Collision.collides(collider.body.body, collisionTargetBody.body); + if (collision && collision.collided) { points[pointsTarget] = (points[pointsTarget] || 0) + 1; } } @@ -97,4 +97,4 @@ export default class DetectPointsCollisionSystem extends System { } } } -}; +}