Detecting Object Crushing

Julian Spillane
Posts: 9
Joined: Tue Aug 12, 2008 9:15 pm

Detecting Object Crushing

Post by Julian Spillane »

Hey all,

We're using Bullet in our current Wii title, and we want to implement a generic system for crushing damage for our character. I'm just not sure how to go about detecting if our character object is being crushed. Just to clarify, we define crushing as any collisions that would cause compression on the character (e.g. a moving platform moving down from above, walls closing in, etc.).

If it helps we currently represent the player using a dynamically simulated capsule.

I'm really stumped about how to go about detecting this kind of thing, so if you guys have any ideas it would be greatly appreciated.

Thanks a lot!
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Detecting Object Crushing

Post by sparkprime »

Someone else can probably give a more bullet-specific answer but it seems to me that you want the sum of the magnitudes of the impulses inflicted on the rigid body by collisions. You could do the standard collision callback stuff to get the contacts, then get the impulses from there, and then sum them all up.
Julian Spillane
Posts: 9
Joined: Tue Aug 12, 2008 9:15 pm

Re: Detecting Object Crushing

Post by Julian Spillane »

That's a smart thought. Although we should probably consider and compare the magnitude of the sum of the impulses to the sum of the magnitudes of the impulses, since two impulses going in almost parallel directions (where we wouldn't want to detect a crush) would have a sum of magnitudes close to the magnitude of their sum. Two impulses that would crush, however, would probably have a high sum of magnitudes but the magnitude of the sums would be low.

Does that make any sense? It's probably way too naive, but maybe that'll work. I'll try it and let you know. :)

Thanks for your advice.
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Detecting Object Crushing

Post by sparkprime »

I think it should crush in the 2 parallel impulses case because you're accelerating it really hard - like a jet fighter pilot - lots of Gs
sparkprime
Posts: 508
Joined: Fri May 30, 2008 2:51 am
Location: Ossining, New York

Re: Detecting Object Crushing

Post by sparkprime »

However if you did want to count just the "wasted" impulses that cancel each other out, you can divide the sum of the magnitudes by the magnitude of the resultant vector I think.

edit: actually subtracting it is probably the right operation :)