littlejsengine 1.17.14 → 1.17.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -35,7 +35,7 @@ const engineName = 'LittleJS';
35
35
  * @type {string}
36
36
  * @default
37
37
  * @memberof Engine */
38
- const engineVersion = '1.17.14';
38
+ const engineVersion = '1.17.15';
39
39
 
40
40
  /** Frames per second to update
41
41
  * @type {number}
@@ -1767,15 +1767,17 @@ function lineTest(posStart, posEnd, testFunction, normal)
1767
1767
  // set hit point
1768
1768
  const hitPos = vec2(posStart.x + dirX*t, posStart.y + dirY*t);
1769
1769
 
1770
- // move inside of tile if on positive edge
1770
+ // ensure result is inside the tile
1771
1771
  const e = 1e-9;
1772
- if (wasX)
1773
- {
1774
- if (stepX < 0)
1775
- hitPos.x -= e;
1776
- }
1777
- else if (stepY < 0)
1778
- hitPos.y -= e;
1772
+ const hitPosFloor = hitPos.floor();
1773
+ if (hitPosFloor.x < pos.x)
1774
+ hitPos.x = pos.x;
1775
+ else if (hitPosFloor.x > pos.x)
1776
+ hitPos.x = pos.x + 1 - e;
1777
+ if (hitPosFloor.y < pos.y)
1778
+ hitPos.y = pos.y;
1779
+ else if (hitPosFloor.y > pos.y)
1780
+ hitPos.y = pos.y + 1 - e;
1779
1781
 
1780
1782
  // set normal
1781
1783
  if (normal)