diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-11-05 22:41:05 +0100 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2018-11-05 22:41:05 +0100 |
commit | ae7674181e8dfae5ec0e691e59fc0b5c1ab8ddd3 (patch) | |
tree | df4d744014c8c7b8b92877d6013121b889f0ceeb /src/math | |
parent | 3469b37b1b748a9a7d907cd26ec13266eec380fa (diff) | |
download | rpgedit-ae7674181e8dfae5ec0e691e59fc0b5c1ab8ddd3.tar rpgedit-ae7674181e8dfae5ec0e691e59fc0b5c1ab8ddd3.zip |
math/line: explicitly allow movement away from line segments
Diffstat (limited to 'src/math')
-rw-r--r-- | src/math/line.ts | 3 |
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); |