summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2018-11-05 22:41:05 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2018-11-05 22:41:05 +0100
commitae7674181e8dfae5ec0e691e59fc0b5c1ab8ddd3 (patch)
treedf4d744014c8c7b8b92877d6013121b889f0ceeb
parent3469b37b1b748a9a7d907cd26ec13266eec380fa (diff)
downloadrpgedit-ae7674181e8dfae5ec0e691e59fc0b5c1ab8ddd3.tar
rpgedit-ae7674181e8dfae5ec0e691e59fc0b5c1ab8ddd3.zip
math/line: explicitly allow movement away from line segments
-rw-r--r--src/math/line.ts3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/math/line.ts b/src/math/line.ts
index 28a636e..2e38f81 100644
--- a/src/math/line.ts
+++ b/src/math/line.ts
@@ -111,6 +111,9 @@ export class LineSegment extends Line implements Collidable {
if (this.distancePoint(move.p1) < 0)
return false;
+ if (crossz(move.v, this.v) < 0)
+ return false;
+
const t = this.getNormal(vec2.create());
vec2.scale(t, t, -r);