In my PhysiBricks game, the user is able to fire a ball at a group of stacked bodies. I noticed that when I reduced the number of times per second it ran using the TargetElapsedTime and IsFixedTimeStep=true, my ball would sometimes go right through the bodies without colliding with them. This was very frustrating. I found that if I raised the number of iterations per second to 50, I didn’t see this problem. The funny thing was, I had the problem regardless of whether Continuous Collision Detection was on or not.
You may be asking why I would want to reduce the number of iterations per second? Well, the more iterations the less bodies I can have in play simultaneously, while keeping a descent frame rate.
I was recently looking through the properties of a Body and found a property called “IsBullet”. Immediately, it dawned on me that Continuous Collision Detection would only work if this was set to true. I ran it in the debugger and found that the value was false by default. I quickly changed the code to set it to true for the balls that I am firing. After doing this the anomaly was gone. Sweet! This means I can reduce the iterations per second to 30 and get more bodies on the screen at one time. Very nice, especially since I am developing this for the Windows Phone 7, which has limited processing power.