Spawning explosions and detecting objects in range


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?


I believe that what you could do is use a spherecast with a radius of your explosion( . Then apply explosion force depending on how far away from the explosion the objects are. Hope this helps!