# Approaching a collision/destruction problem, need help calculating energy propagation through bodies

This topic is 1242 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hello, everybody!

I am trying to implement destructable objects in my game, and I am currently stuck with 'physics of impulse propagation' (I don't know how to say it properly).

My problem can be described in the following way:

Imagine I have a circular projectile and a rectangular obstacle, both of them on a 2d plane, for simplicity. The projectile is launched towards the obstacle.
The obstacle is a wall, consisting of small rectangular 'bricks', which are placed next to each other (in some kind of a regular pattern to form a 2d 'wall').
The bricks are atomic (indivisible) solid hard shapes, cannot break, cannot deform. Bricks are glued together with cement to make a strong 'wall obstacle'. The cement between bricks is virtual, there's nothing physical in between the bricks, the cement itself is just a simplification of weakest points between any two neighboring bricks, so, if a crack is made in a wall, the crack would most probably propagate through cement between bricks. In my simplified model the bricks are atomic, so the only path for a crack to propagate inside a wall – is through cement between bricks. Therefore, when a projectile hits the wall, depending on the energy of the collision, the wall should be broken into several single bricks and patches of several bricks of various sizes.

If a projectile hits the wall with significant velocity, it should penetrate the wall. What I want to achieve is somewhat-simplified, but still looking realistically-enough physics of breaking a hard body into pieces, specifically physics of debris produces by a hit. In general, after a penetrating hit, there should be several smaller chips flying off the wall (through the other side of the wall), some bigger chunks of several bricks, flying sideways, and two big separated parts of the obstacle wall with most of bricks still in them.

What I have as 'given' at any point in time:
1. all the masses and velocities
2. the impulse of the initial hit
3. the connectivity graph between the bricks
4. strength threshold of cement (strength of each link between bricks in a connectivity graph) in arbitrary 'units', say some maxForce / somePeriodOfTime. For simplicity, strength of cement is uniform across the wall.

Here's a rough illustration of the problem with my comments in blue, yellow and orange. The bricks on this image are not glued together, so the wall simply flies apart. The projectile has just collided with the green vertical wall a few moments ago:
[attachment=28836:Screen-Shot-2015-08-22-at-18.41.45.jpg]

My problem is reduced to calculating how an impulse from a projectile should propagate between the bricks (to make cracks, to penetrate obstacles and to chip off some bricks also). Many games use Voronoi for fractures, but it does not account for impulse propagation as far as I know, it just splits a polygon or a mesh into roughly equal areas / volumes. In my case, the result of the split made by a crack should go between bricks, which can be thought of as a result of fracturing with Voronoi. But I'm not using Voronoi, because my wall is 'prefractured' already in some sense.
So, my question is actually this: what kind of physics do i need to dive into, to target the 'stress/impulse propagation inside a structure of several bodies' problem? Intuitively, the impulse has to split along the fracture lines somehow to disperse the hit, but the actual mechanics of that is unknown to me, I really need some supervising guidance here.

Thank you in advance for your help, and sorry for such a long text.

##### Share on other sites

what kind of physics do i need ... ?

As you've already decided what behavior you want from the system, it's not a matter of physics. You need to setup a model to do what you want - i.e., make up a system of rules that produces the desired results.

Just a guess at what may give you what you're looking for - rather than having a fixed adhesion between bricks, consider a probability (a bit of randomness around a fixed value) that a crack will form between bricks based on distance from the impact. If a system of cracks (or a sufficient number of cracks) form around a chunk, consider that chunk then to be free and becomes another projectile.

##### Share on other sites

consider a probability (a bit of randomness around a fixed value) that a crack will form between bricks based on distance from the impact. If a system of cracks (or a sufficient number of cracks) form around a chunk, consider that chunk then to be free and becomes another projectile.

Thank you, Buckeye, for your answer! The thing is, I know what I want, but I don't know all the details I need to make it... As for randomness – that's actually implied by the random nature of fractures, so, yes, I will have randomness in either variable strength of cement or just runtime random chance. That's the easy part. The part that I don't understand is how do i calculate proportional split of the force of the impact and transfer it evenly to newly freed chunks to launch them after they are actually split?

##### Share on other sites

You might try simulating it from an energy standpoint. The projectile, at impact, provides a total energy (E) of 1/2mv2. After the size of each chunk that will move (that will have velocity) has been determined, determine the total mass (M) that will then be moving - i.e., the sum of all the mass of the moving chunks. The energy of each chunk will then be E * chunk-mass / M. Given the chunk's energy, chunk-velocity = sqrt( 2 * chunk-energy / chunk-mass ). I haven't a clue whether that will give you the results you've specified, but it may give you a basis for playing around with proportions, tweaking constants, etc.

Something similar could be done with momentum - incoming projectile momentum = mv. The sum total of outgoing momentum must = mv, using the same method described above to proportion each chunk's momentum.

##### Share on other sites

The part that I don't understand is how do i calculate proportional split of the force of the impact and transfer it evenly to newly freed chunks to launch them after they are actually split?

In addition to conservation of momentum, I would try to look at the average direction of each surface involved in the collision, both new cracks and the initial surface hit.  My guess at a quick solution is that the momentum transfer would be proportional to the dot product of the impact direction and the crack's average normal.  Cracks that form with normals parallel to the impact direction will help the impact particle transfer momentum to the fractured chunk, while perpendicular cracks will not.

##### Share on other sites

You might try simulating it from an energy standpoint. The projectile, at impact, provides a total energy (E) of 1/2mv2. After the size of each chunk that will move (that will have velocity) has been determined, determine the total mass (M) that will then be moving - i.e., the sum of all the mass of the moving chunks. The energy of each chunk will then be E * chunk-mass / M. Given the chunk's energy, chunk-velocity = sqrt( 2 * chunk-energy / chunk-mass ). I haven't a clue whether that will give you the results you've specified, but it may give you a basis for playing around with proportions, tweaking constants, etc.

Something similar could be done with momentum - incoming projectile momentum = mv. The sum total of outgoing momentum must = mv, using the same method described above to proportion each chunk's momentum.

Thank you so much, Buckeye! The model you proposed with proportional distribution of energy sounds almost like what I need. The only thing left here is to account not only for linear velocities, but also for angular velocities, I mean, i need to calculate points and normals to add some rotations applied at certain points of newly separated chunks, not just linear velocities at centers of chunks. If I just apply linear velocity to each chunk (directed from point of impact to each chunk's center) - it makes them fly apart, but that looks kinda 'oversimplified' and not as realistic as it might be. One option would be to simply randomize rotations. That probably would generate better breaking effects, but still not realistic enough. I think I need to make them fly and rotate with proper linear and angular velocities, but I am not very good at maths and physics for that. I would appreciate If you could give a short explanation on how to define directions of propagation of the hit impulse. I may be misunderstanding something, but what's the direction(s) of energy/chunk-velocities there in your previous post?

##### Share on other sites

The part that I don't understand is how do i calculate proportional split of the force of the impact and transfer it evenly to newly freed chunks to launch them after they are actually split?

In addition to conservation of momentum, I would try to look at the average direction of each surface involved in the collision, both new cracks and the initial surface hit.  My guess at a quick solution is that the momentum transfer would be proportional to the dot product of the impact direction and the crack's average normal.  Cracks that form with normals parallel to the impact direction will help the impact particle transfer momentum to the fractured chunk, while perpendicular cracks will not.

Thanks, Aledrinker! As for the avg normal of the crack – I think I got it, depending on the crack directions, long chunks on the way of the projectile would impose more resistance on the projectile, is that correct?

##### Share on other sites

That is along the lines of what I was saying, although I was thinking about a very small impact particle, so I wasn't really thinking about effects of its size or the length of the cracks.  But yes, if there was a chunk that had a surface that mostly faced the incoming particle, it will take a good portion of the particle's momentum.

That being said, if you want to do rotations as you said before, you may want to look at the surface normal at the point of contact for each collision instead of the normal of the average crack direction for each crack, since the average will wipe out rotations from any interesting jaggedness you may have.  It really just depends on whether or not doing it this way ends up giving you the effect you're looking for.

Sometimes things will fracture and spend most of the impact energy forming cracks and it doesn't look very interesting.

Edits:  Fixed bad grammar and ambiguity.

Edited by Aledrinker

##### Share on other sites

You could make a wall of blocks and add constraints between adjacent blocks to keep them in place. Then, whenever a constraint's applied force exceeds a certain value, you remove the constraint.

I made a small example here, it doesn't work all that great but it should work better if you use a proper physics engine.

http://www.d3planner.com/webgl/wall

Edited by d07RiV

##### Share on other sites

You could make a wall of blocks and add constraints between adjacent blocks to keep them in place. Then, whenever a constraint's applied force exceeds a certain value, you remove the constraint.

I made a small example here, it doesn't work all that great but it should work better if you use a proper physics engine.

http://www.d3planner.com/webgl/wall

That's almost exactly what I am talking about! But how do you propagate collisions in the demo ? Do you remove joints and then reapply forces to the detached bodies, or do you simply remove joints on first contact and continue stepping? I have a setup of Box2d, Chipmunk and Bullet in my engine, so I can use any of them, they seem to have similar APIs, but in either of them I still have to make user-defined behaviour for breaking joints and force propagation. As for breaking joints under forces exceeding some maximum threshold, that is all clear to me. But what do you do with the impulse upon detachment of the bodies? Also, how did you make the wall to break into chunks, instead of separate bricks? According to simple 'weak joint' solution, the area of damage would've been concentrated around the point of impact (would've detach closest bricks), but would not cause cracks to chip large chunks off the wall. So there must be something going on with recalculating connectivity in this demo, though I did not figure what exactly is happening there yet. Can you give some insights on that?

Edited by p1p1

• ### What is your GameDev Story?

In 2019 we are celebrating 20 years of GameDev.net! Share your GameDev Story with us.

• 13
• 9
• 15
• 14
• 46
• ### Forum Statistics

• Total Topics
634058
• Total Posts
3015288
×