Destruction of compound object

STTrife
Posts: 109
Joined: Tue May 01, 2012 10:42 am

Destruction of compound object

Post by STTrife »

Hi there,

I was wondering about the following idea. Say you have an object made out of boxes (a compound object). For example a rubic's cube made out of 27 boxes. When I would like to do is some 'destruction' on impact. So if it falls on a corner it would destroy the corner piece.

My first idea is to find the impact points, and remove the cube(s) that are hit too hard (how can you measure this?) each frame.

One disadvantage of this, if I'm correct, is that no matter how hard the object hits the floor, only the first layer of cubes could be destroyed and the object would bounce back after that.
Better would be if on high impact, more than one layer could be destroyed. If I'm not mistaken, that would mean that if cubes inside the object are destroyed on impact, the impulse that were generated to push back the object would have to be reduced, so that the next frame the object is still heading in the same direction, so the cubes behind the destroyed cubes also have a chance of impacting.

This all doesn't have to follow real physics rules or anything, but I just want something believable for a simple game :)

Has anyone ever tried something like this? How could this be accomplished in general in bullet?

Thanks!
User avatar
SynapticBytes
Posts: 74
Joined: Thu Feb 10, 2011 8:27 pm

Re: Destruction of compound object

Post by SynapticBytes »

This probably isn't the effect you're looking for, but using constraints between your cubes and using a constraint breaking threshold should make it break apart on impact.

Otherwise as you say, detect collision then remove the colliding cube, and maybe then add another downward impulse to force the next pieces into the ground.