Collision Response for Object that Breaks Apart ?

Started by
2 comments, last by Endemoniada 19 years, 4 months ago
Hi guys, I'm working in 2D and treating my objects as particles. When a 'medium' sized object gets hit it breaks into two 'small' sized objects, and when a 'small' sized one gets hit it gets destroyed. The object that hits them is like a cannonball and it's the same size as the 'small' sized objects. Alright, I tried a few things and nothing is very satisfying. If I don't reflect the cannonball it usually hits one of the small objects (one of the two that spawned from the medium object) and destroys it, if I do reflect it it really doesn't look right because it shouldn't really be bouncing off. Also, the 'large' sized objects may break into three 'small' ones which will act so badly the way I'm doing it now that I didn't even try it yet. I'm not looking for perfect physics, just something that is solid (works nicely) and looks cool. Oh, the objects above are pretty much like boulders (asteroids) but I made another type of object that also splits up that is more like a jellyfish (slimeball ?) and I don't know how to handle those either. Any ideas would be appreciated. Thanks guys, Cyrus
Advertisement
for simple rigid body dynamics (and I mean simple),

stuff

Based on Chris Hecker's physics tutorials, if you want to get to the source of things.

as for modelling a cannonball, and doing breakage, using some rigid body dynamics, it's only a matter of tweaking the masses, coefficients of restitutions and so on.

To prevent the cannonball destroying the smaller chunks straight away, you can add an activation timer on the chunks, say one second, and also use the cannonball speed, or energy of the colision. Since the cannonball will speed will be greatly reduced, then when it hits a small chunk again, it should not damage it.

for tumbling, and cool effects, the RBD above should provide you with some ideas.

for soft bodies, you can model corners of the body with springs, interlinked with each other, and use the formed polygons for collision detection. Once a collision is detected, with the contact points, you can push the colliding corners away, and that should deform your jelly.

for an example of this,

other stuff

note that the physics in that demo aren't really compatible with a rigid body system, but a spring-based approach should act quite similar to this and would work.

You can also use the verlet aproach for everything if you fancy.

Everything is better with Metal.

i think your problems might arise from the new objects starting off interpenetrating. make sure they are not.

make sure to conserve momentum (m*v)

as for the cannonball: in reality it would probably punch trough, but thats hard to recreate without accidentily hitting a new object. maybe a little hack would suffice: disable collision between the cannonball and the new objects. or just have it vaporize.
Thanks guys,

Alright, I'll probably disable the collision detection of the newly spawned objects for a second, and maybe make it so the cannonball slows down as well.

But I still don't know what velocities (directions really) the newly spawned objects should have, maybe the same as the original big one if it didn't break ? I tried random directions but it looked stupid. What do you think ?

Take care.

PS - Hey oliii, it's nice to see you are still here, I was coming a lot last year and you helped me out.

This topic is closed to new replies.

Advertisement