danfis / libccd

Library for collision detection between two convex shapes
Other
505 stars 111 forks source link

ccdGJKPenetration: Access violation reading location 0x0000000000000000. occurred #68

Closed Mikez2015 closed 4 years ago

Mikez2015 commented 4 years ago

Hello, I found bug.

Unhandled exception at 0x00007FF6342D9F26 in Game.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

https://i111.fastpic.ru/big/2020/0320/20/ea4db037dd71bda21188807856fb7d20.jpg

Visual Studio 2019, x64, Windows 10

Mikez2015 commented 4 years ago

dir.v[0] = -nan(ind)

A negative number forms under the sqrt()? Pow function is the fractional power of a negative number?

Mikez2015 commented 4 years ago

I think what problem here: *depth = CCD_SQRT(nearest->dist);

Mikez2015 commented 4 years ago

Every time an error occurs - before the error, the result of the previous function call:

dir.v[0] = -nan(ind); dir.v[1] = -nan(ind); dir.v[2] = -nan(ind); depth = 0;

Mikez2015 commented 4 years ago

I continue to search for the exact location of the error. Error in ret = __ccdGJKEPA(obj1, obj2, ccd, &polytope, &nearest);

Mikez2015 commented 4 years ago

even closer:

if (nextSupport(obj1, obj2, ccd, *nearest, &supp) != 0)
            break;
Mikez2015 commented 4 years ago

Error here, in if (nextSupport(obj1, obj2, ccd, *nearest, &supp) != 0):

    if (el->type == CCD_PT_VERTEX) {
        return -1;
    }

I think what error appears when "el->type == CCD_PT_VERTEX" Why?

Mikez2015 commented 4 years ago

I noticed that an error occurs when two boxes touch exactly with planes (the rotation angles of both boxes are zero).