From 9ed744ac73adf87fc4411033d3512ed8c5a2c3a2 Mon Sep 17 00:00:00 2001 From: Sami Ullah Date: Mon, 10 Feb 2020 13:11:37 +0400 Subject: [PATCH] fixed params for wall detection --- src/scripts/core/utils.js | 5 +++-- src/scripts/items/floor_item.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scripts/core/utils.js b/src/scripts/core/utils.js index 2ebdc7d..ee798a2 100644 --- a/src/scripts/core/utils.js +++ b/src/scripts/core/utils.js @@ -192,7 +192,7 @@ export class Utils { tSecondCorner = firstCorners[tI + 1]; } - if (Utils.linePolygonIntersect(tFirstCorner.x, tFirstCorner.y,tSecondCorner.x, tSecondCorner.y, secondCorners)) + if (Utils.linePolygonIntersect(new Vector2(tFirstCorner.x, tFirstCorner.y), new Vector2(tSecondCorner.x, tSecondCorner.y), secondCorners)) { return true; } @@ -305,7 +305,8 @@ export class Utils tSecondCorner = corners[tI + 1]; } - if (Utils.lineLineIntersect(start, point, tFirstCorner.x, tFirstCorner.y, tSecondCorner.x, tSecondCorner.y)) + if (Utils.lineLineIntersect(start, point, + new Vector2(tFirstCorner.x, tFirstCorner.y), new Vector2(tSecondCorner.x, tSecondCorner.y))) { tIntersects++; } diff --git a/src/scripts/items/floor_item.js b/src/scripts/items/floor_item.js index 4624e7b..7eb3ce4 100644 --- a/src/scripts/items/floor_item.js +++ b/src/scripts/items/floor_item.js @@ -67,8 +67,8 @@ export class FloorItem extends Item { //We do not want to check if the object is in room or not //It is upto the user to place it anywhere he/she wants however -// return false; - return true; + return false; + // return true; } // check if we are outside all other objects