One problem with simulating an explosion realistically is the way in which the blast should apply force to parts of an object rather than just its center of gravity. For example, in the really simple way to do it (apply impulse to center of mass of objects (inverse square) proportional to distance from explosion), if you place a bomb under one side of a long plank or some such object, the object will move diagonally and will never rotate, whereas realistically the long object will have the part lying over the explosive be sent upwards with great force, which results in torque and lots of rotation.
Something that I had been thinking about to provide support for this was to raycast radially outward from explosion point and apply forces based on the ray collisions. This however has to be tweaked and will miss small objects. If you want it to work on small objects it could end up running quite slow.
So since there is a way, built into box2d, that measures the penetration/separation of two shapes when they are intersecting, why not just create a circular sensor or shape when an explosion goes off, and for each shape that it intersects, calculate the "penetration" value, determine the location of intersection, and apply forces accordingly? Does anyone see anything wrong with this approach? It should be possible to do it, right?
Something that I had been thinking about to provide support for this was to raycast radially outward from explosion point and apply forces based on the ray collisions. This however has to be tweaked and will miss small objects. If you want it to work on small objects it could end up running quite slow.
So since there is a way, built into box2d, that measures the penetration/separation of two shapes when they are intersecting, why not just create a circular sensor or shape when an explosion goes off, and for each shape that it intersects, calculate the "penetration" value, determine the location of intersection, and apply forces accordingly? Does anyone see anything wrong with this approach? It should be possible to do it, right?