Broadphase Pair Problem - WP7

Topics: Developer Forum, User Forum
Mar 16, 2012 at 5:22 AM

I ran into a problem that happens about 5% of the time with a simple game I wrote (XNA 4.0, FPE 3.3.1).  I have a bunch of dynamic circles (bubbles) that float around and stay on the screen with 4 static borders.  The user "pops" the bubbles with their finger - collision is detected when the user lifts their finger from the screen.  I queue up a list of the contacts on collision and after world.step completes, I remove the bubbles and their associated sprites.

5% of the time when world.step is called, I get a null reference exception.  world.contact.list.count = 0; however, whenever the exception occurs, the world.contactmanager.broadphase has a pairCount of 1.  Since there are no body, the shapetype is null and the exception is thrown somewhere in Contacts.

Any idea why this happens, since I'm not deleting bodies when collisions are occurring but after world.step has completed?

thanks,

Mike