Here's the deal. I got bombs (note to FBI: virtual ones). When they hit something, the bombs should spawn an immobile explosion that should deal X points of damage to all objects in range.
Now, I currently have a prefab for that explosion object. On that object is a trigger collider, a script, and a few other irrelevant components. In the script I react to OnTriggerEnter(), but that apparently is very unreliable.
I read elsewhere that colliders are quite finnicky, especially when spawned within each other. Might that be my problem? Or maybe there has to be movement in order for collisions to register?
How would you go about applying instant damage to all objects within a collider that was just spawned?
asked May 12 '11 at 03:47 PM
I believe that what you could do is use a spherecast with a radius of your explosion(http://unity3d.com/support/documentation/ScriptReference/Physics.SphereCastAll.html) . Then apply explosion force depending on how far away from the explosion the objects are. Hope this helps!
answered May 12 '11 at 03:58 PM