summaryrefslogtreecommitdiffstats
path: root/src/math
diff options
context:
space:
mode:
Diffstat (limited to 'src/math')
-rw-r--r--src/math/line.ts6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/math/line.ts b/src/math/line.ts
index d29bc76..28a636e 100644
--- a/src/math/line.ts
+++ b/src/math/line.ts
@@ -108,6 +108,9 @@ export class LineSegment extends Line implements Collidable {
}
public collide(out: vec2, move: Movement, r: number): boolean {
+ if (this.distancePoint(move.p1) < 0)
+ return false;
+
const t = this.getNormal(vec2.create());
vec2.scale(t, t, -r);
@@ -121,9 +124,6 @@ export class LineSegment extends Line implements Collidable {
}
private collideRef(out: vec2, move: Movement): boolean {
- if (this.distancePoint(move.p1) < 0)
- return false;
-
if (this.distancePoint(move.p2) >= 0)
return false;