Creating a Shockwave on gameObject impact.

I have this rocket prefab going around the map and colliding with other prefabs, doing damage or nothing at all.

Well, I want to make a “damage sphere” around the rocket so I can check both against what the rocket collides and if there is something on its “action radius” (So it got some damage too), but I’m a bit puzzled about how to do it.

My idea is to create a sphere object and make it grow (changing its scale factor) for a configurable amount of time from “min radius” to “max radius” using the update (or equivalent) function to check if something got hit each frame or each time the physics are updated.

But I’m not really sure if that’s the best option or if there’s something else around to do it. I’m working in a prototype-level game, so graphics are not my first concern, but if using particles would ease future work, maybe I should look into it.

Well, given that I managed to solve it and I didn’t got any answers here, I’ll answer myself:

Short answer: Physics.OverlapSphere(center, radius)

Long, kind of explained: This function creates a spehere centered in “center” with the given radius and returns an array with all Colliders inside of it.

So, what I do to create the “explosion”/“shockwave” is to call this function in the update() function of the class that creates the explosion, and at each call increase the radius. I use a small dictionary/hash table to store the entities already affected by the explosion, so I don’t “hit” twice the same entity.

There’s another way, using colliders, but I found this to be a bit easier and quick for what I was looking for. Of course, there isn’t any kind of explosion effect.