Report any bugs here and we'll post fixes
Moderators: Sascha Willems, Thomas
by aitzolmuelas » Fri May 22, 2015 11:29 am
I just got a crash in the following piece of code (dgCollisionConvex.cpp line 3157):
- Code: Select all
dgFloat32 den = normal % veloc;
if (den >= dgFloat32 (-1.0e-6f)) {
// bodies are residing from each other, even if they are touching they are not considered to be colliding because the motion will move them apart
// get the closet point and the normal at contact point
count = 0;
proxy.m_timestep = timestep;
proxy.m_normal = matrix.RotateVector(invScale.CompProduct4(minkHull.m_normal.Scale4 (-1.0f)));
dgAssert (proxy.m_normal.m_w == dgFloat32 (0.0f));
proxy.m_normal = proxy.m_normal.CompProduct4(proxy.m_normal.InvMagSqrt());
proxy.m_closestPointBody0 = matrix.TransformVector(scale.CompProduct4(minkHull.m_p)) & dgVector::m_triplexMask;
proxy.m_closestPointBody1 = matrix.TransformVector(scale.CompProduct4(minkHull.m_q)) & dgVector::m_triplexMask;
break;
}
The inverse crashed because proxy.m_normal is zero, and I was wondering if it got inside the conditional block because
- Code: Select all
if (den >= dgFloat32 (-1.0e-6f)) {
should actually be
- Code: Select all
if (den >= dgFloat32 (1.0e-6f)) {
I'm going to try that now, but this is rather infrequent...
-
aitzolmuelas
-
- Posts: 78
- Joined: Wed Mar 25, 2015 1:10 pm
by aitzolmuelas » Fri May 22, 2015 11:39 am
Nope, changing that sign is not OK (i saw now 'den' is being used later on). The crash is still there, but the sign is not the cause...
-
aitzolmuelas
-
- Posts: 78
- Joined: Wed Mar 25, 2015 1:10 pm
by Julio Jerez » Fri May 22, 2015 1:09 pm
Maybe dgAbsf (den) ?
I will check it out tonight.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
by Julio Jerez » Sun May 24, 2015 8:59 pm
ok I fix it,
- Code: Select all
if (den >= dgFloat32 (-1.0e-6f))
is correct.
the bug was that calculate the normal again when it was calculated before the test.
- Code: Select all
//proxy.m_normal = matrix.RotateVector(invScale.CompProduct4(minkHull.m_normal.Scale4 (-1.0f)));
proxy.m_normal = matrix.RotateVector(normal.Scale4 (-1.0f));
sync again please.
-
Julio Jerez
- Moderator
-
- Posts: 12249
- Joined: Sun Sep 14, 2003 2:18 pm
- Location: Los Angeles
-
Return to Bugs and Fixes
Who is online
Users browsing this forum: No registered users and 4 guests