SpuGatheringCollisionTask Compound Shape crash fix

Bbilz
Posts: 26
Joined: Wed Feb 27, 2008 9:55 am

SpuGatheringCollisionTask Compound Shape crash fix

Post by Bbilz »

I have been having a crash in the SPU code when using compound objects - Tracing it back up it seems to be passing in invalid collision shape data to the handleCollisionPair function at line 1166. I figured that compound objects often swap their collisionShape pointer around between their sub-objects and maybe it should be the RootCollisionShape that gets passed in instead.

In SpuGatheringCollisionTask.cpp
At line 1166 I have changed:

Code: Select all

handleCollisionPair(collisionPairInput, lsMem, spuContacts, 
                         (ppu_address_t)lsMem.getColObj0()->getCollisionShape(), &lsMem.gCollisionShapes[0].collisionShape,	                    
                         (ppu_address_t)lsMem.getColObj1()->getCollisionShape(), &lsMem.gCollisionShapes[1].collisionShape);
to:

Code: Select all

handleCollisionPair(collisionPairInput, lsMem, spuContacts,
                         (ppu_address_t)lsMem.getColObj0()->getRootCollisionShape(), &lsMem.gCollisionShapes[0].collisionShape,
                         (ppu_address_t)lsMem.getColObj1()->getRootCollisionShape(), &lsMem.gCollisionShapes[1].collisionShape);
This fixes the crash and everything seems to work correctly. I have supplied a patch of my changes

Cheers!
You do not have the required permissions to view the files attached to this post.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: SpuGatheringCollisionTask Compound Shape crash fix

Post by Erwin Coumans »

Thanks for the report and bugfix.

We'll look into fixing this, you can track progress in the issue tracked (attached the patch so it doesn't get lost in the forum discussions)

http://code.google.com/p/bullet/issues/detail?id=313