   Handling explosions
  I'm at the stage in the development of my 2-D physics engine where I need to add support for explosions. I've run into an obstacle: how should I handle obstructions? In other words, I'm trying to make sure an explosion cannot hit an object on the other side of a wall.The way I have it currently set up, the terrain is stored both as a set of polygons in a quad tree and as a BSP tree. Obstructing movable objects like crates are stored in a quad tree dynamically.I have a ray test set up, so in the worst case scenario I simply perform a whole bunch of ray casts in a brute force approach. However, I would prefer a less clumsy method.Any ideas?In the scenario I'm dealing with, static terrain data can be precalculated and dynamic obstructions are generally large and few and far between. However, there will likely be a moderate number of dynamic non-obstructing objects floating around as debris or corpses or live characters.Also, non-interpenetration is enforced via penalty-force methods (I'm using ODE).I've considered two methods:1. Use a "radial query" which generates a visibility data structure, and then use that to test for whether the object is obstructed from the explosion.2. Use a ray-sweep where I perform ray casts at "critical points" where obstructing polygons begin and end.The second one is more attractive because I already have ray casting code in place and working flawlessly. The issue I have with the second one is that it has limited versatility - it can test for visibility, and that's it.Any help or guidance is much appreciated. Thanks for your time.-Guru2012   
  I would do it like this ...First restrict the collection of potentially 'hit' objects by radius. In most game worlds this will give you a limited set of objects, say 100 max, that are in the explosion radius. (Very large explosions would be different, but they should modify terrain and all sorts of stuff too, so I'm going to assume your explosions are small.)Then just do a ray visibility check for each object before applying the explosion. If you want realism, check the points at maximum and minimum angular deviation (i.e. the 'top' and 'bottom' as seen from the explosion) and if only one is visible apply a torque as well as a force to the object. It is a 'brute force' solution but with only a few objects that shouldn't matter.   