Broad and narrow detection / contact solving question

Please don't post Bullet support questions here, use the above forums instead.
oztune
Posts: 24
Joined: Tue Aug 21, 2007 12:13 am

Broad and narrow detection / contact solving question

Post by oztune »

Hey,

Sorry for the long question, I just want to explain myself entirely. I should start out by saying I'm using a projection/penalty based penetration solver

Up until now I've been using a very simple process of events in my main loop for prototyping purposes. It does broad phase + narrow phase collision detection in each iteration (I'm doing 10 iterations for example) of each time step. This way if one penetration fix caused another, it will discover it in the next iteration. This is very inefficient and on the platform I'm using (the flash virtual machine) it's good to squeeze out as much performance as possible.

I don't want to get into any fancy broad phase yet, so what I tried to do is perform an SAT test between all pairs once per time step, and store all the colliding pairs of polygons.
Then I iterate through all the pairs, checking if they are penetrating and moving them out of penetration if necessary.

But it doesn't work... If resolving one penetration causes penetration somewhere else, it would only be resolved in the next frame... and that causes a lot of jitter and jumpiness if a lot of objects are in close proximity.

There must be a better way out there, and this is probably the best place to ask.

Thanks,
Oz
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Re: Broad and narrow detection / contact solving question

Post by Erin Catto »

You can store the local coordinates of the contact points. After each iteration you can do a cheap contact point analysis to get the new penetration depths.
oztune
Posts: 24
Joined: Tue Aug 21, 2007 12:13 am

Re: Broad and narrow detection / contact solving question

Post by oztune »

Thanks for the reply Erin. I was also thinking about something along the same lines.
but I think my main problem (which is causing the jitter) is that if one penetration correction between two objects caused a penetration somewhere else, it would only find out on the next frame. My initial idea is to add pairs of objects to the solver even if they're not colliding but just in close proximity but I'm not sure how to go about doing that. Also I was wondring if it would mess up the next step of solving velocities.

Thanks
oz
Erin Catto
Posts: 316
Joined: Fri Jul 01, 2005 5:29 am
Location: Irvine

Re: Broad and narrow detection / contact solving question

Post by Erin Catto »

Perhaps you are trying to resolve overlap too quickly and overshooting. Try to scale down your projections (as with the Baumgarte parameter).