BUG: gContactAddedCallback index and part ids not swapped

gerbenvv
Posts: 3
Joined: Wed Sep 23, 2009 7:51 am

BUG: gContactAddedCallback index and part ids not swapped

Post by gerbenvv »

Hi,

There is a bug in btManifoldResult.cpp at these lines:

Code: Select all

00112                 //experimental feature info, for per-triangle material etc.
00113                 btCollisionObject* obj0 = isSwapped? m_body1 : m_body0;
00114                 btCollisionObject* obj1 = isSwapped? m_body0 : m_body1;
00115                 (*gContactAddedCallback)(m_manifoldPtr->getContactPoint(insertIndex),obj0,m_partId0,m_index0,obj1,m_partId1,m_index1);
The index and part ids aren't swapped along with the bodies.
Please add a fix in which the those are swapped too.

Thanks,

Gerben
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: BUG: gContactAddedCallback index and part ids not swapped

Post by Erwin Coumans »

Can you create a reproduction case using any of the Bullet demos (not involving btGimpactShape) that shows the issue?

Thanks,
Erwin
gerbenvv
Posts: 3
Joined: Wed Sep 23, 2009 7:51 am

Re: BUG: gContactAddedCallback index and part ids not swapped

Post by gerbenvv »

Hi Erwin,

It'll take some time to create a code snippet to reproduce this.
I can reproduce this every time in my code however, so it's definitely a bug.

I guess this can be reproduced everytime collision bodies are swapped.

Greetings,

Gerben

addContactPoint code:
http://code.google.com/p/bullet/source/ ... ult.cpp#62

[EDIT -> removed long source snippet]
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: BUG: gContactAddedCallback index and part ids not swapped

Post by Erwin Coumans »

Are you using the latest Bullet 2.76 beta, revision 1971 or later?

There was some known issue in Bullet 2.75 or earlier, but it should be fixed in a recent svn trunk version.
Please check line 97 of http://code.google.com/p/bullet/source/ ... ult.cpp#62 for the fix.

With latest trunk, attached reproduction case works just fine, you can swap objects in line 377/378 (just copy the unzipped files over Bullet/Demos/ConcaveDemo)
The triangle mesh has part 0 and index 900, whereas compound has part -1 and index 0, even if you swap the collision shapes on line 377.

If the issue still occurs in the latest Bullet svn trunk, can you please tell what are the types of the two colliding collision shapes when indices are wrongly swapped?
Thanks for the feedback,
Erwin
You do not have the required permissions to view the files attached to this post.
gerbenvv
Posts: 3
Joined: Wed Sep 23, 2009 7:51 am

Re: BUG: gContactAddedCallback index and part ids not swapped

Post by gerbenvv »

Hi Erwin,

Thanks, I didn't know this issue was already solved. I was using version 2.75.
I'll test the new version, but I don't expect any problems, because the fix seems to solve this problem.

Greetings,
Gerben