math/line: explicitly allow movement away from line segments
This commit is contained in:
parent
3469b37b1b
commit
ae7674181e
1 changed files with 3 additions and 0 deletions
|
@ -111,6 +111,9 @@ export class LineSegment extends Line implements Collidable {
|
||||||
if (this.distancePoint(move.p1) < 0)
|
if (this.distancePoint(move.p1) < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (crossz(move.v, this.v) < 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
const t = this.getNormal(vec2.create());
|
const t = this.getNormal(vec2.create());
|
||||||
vec2.scale(t, t, -r);
|
vec2.scale(t, t, -r);
|
||||||
|
|
||||||
|
|
Reference in a new issue