check if point lies on clipplane when clipping physics, fixes #6

This commit is contained in:
Sevii 2020-10-12 15:02:10 +02:00
parent 8e3825b89e
commit c88ab97bff

View File

@ -80,7 +80,11 @@ local function clipPlane3D(poly, plane, plane_dir)
if a and b then
table.insert(n, cur)
elseif a or b then
table.insert(n, intersection3D(last, cur, plane, plane_dir))
local point = intersection3D(last, cur, plane, plane_dir)
-- Check since if the point lies on the plane it will return nil
if point then
table.insert(n, point)
end
if b then
table.insert(n, cur)