Skip to content

Commit 9af496c

Browse files
palrajramstedt
authored andcommitted
Update Line.js
Fraction was computed in the wrong order, representing the fraction of the collided line, not of the ray.
1 parent d976fcb commit 9af496c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/shapes/Line.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Line.prototype.raycast = function(result, ray, position, angle){
8383
vec2.toGlobalFrame(l0, l0, position, angle);
8484
vec2.toGlobalFrame(l1, l1, position, angle);
8585

86-
var fraction = vec2.getLineSegmentsIntersectionFraction(l0, l1, from, to);
86+
var fraction = vec2.getLineSegmentsIntersectionFraction(from, to, l0, l1);
8787
if(fraction >= 0){
8888
var normal = raycast_normal;
8989
vec2.rotate(normal, raycast_unit_y, angle); // todo: this should depend on which side the ray comes from

0 commit comments

Comments
 (0)