From 1bee6093e6481ea8974f5fcbd58d95de3270f820 Mon Sep 17 00:00:00 2001 From: "Pablo Ariel Mayobre (Positive07)" Date: Sun, 5 Nov 2017 19:38:18 -0300 Subject: [PATCH] Fixed error in do_line Add start and end arguments to unpack --- gjk.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gjk.lua b/gjk.lua index cd49bf4..2686033 100644 --- a/gjk.lua +++ b/gjk.lua @@ -62,7 +62,7 @@ end local function EPA(shape_a, shape_b) -- make sure simplex is oriented counter clockwise - local cx,cy, bx,by, ax,ay = unpack(simplex) + local cx,cy, bx,by, ax,ay = unpack(simplex, 1, 6) if vector.dot(ax-bx,ay-by, cx-bx,cy-by) < 0 then simplex[1],simplex[2] = ax,ay simplex[5],simplex[6] = cx,cy @@ -96,7 +96,7 @@ end -- B o------o A since A is the furthest point on the MD -- : : in direction of the origin. local function do_line() - local bx,by, ax,ay = unpack(simplex) + local bx,by, ax,ay = unpack(simplex, 1, 4) local abx,aby = bx-ax, by-ay @@ -105,7 +105,7 @@ local function do_line() if vector.dot(dx,dy, -ax,-ay) < 0 then dx,dy = -dx,-dy end - return 4, dx,dy + return dx,dy end -- B .' @@ -116,7 +116,7 @@ end -- o-' 3 -- C '. local function do_triangle() - local cx,cy, bx,by, ax,ay = unpack(simplex) + local cx,cy, bx,by, ax,ay = unpack(simplex, 1, 6) local aox,aoy = -ax,-ay local abx,aby = bx-ax, by-ay local acx,acy = cx-ax, cy-ay