X-Git-Url: https://git.r.bdr.sh/rbdr/sumo/blobdiff_plain/7741a3cc37662ab2ff9606bdaffc0317b79a8dd9..refs/heads/rbdr-bouncy-walls:/lib/systems/detect_points_collision.js diff --git a/lib/systems/detect_points_collision.js b/lib/systems/detect_points_collision.js index 21e6dad..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; } }