Hello Everyone…
i am new in unity and currently i am learning unity…
I want some kind of shock wave effect such that within that shock wave area if i found any object then i want to destroy that object…
All these i want to make within 2D plane with x-y axis…
But i am not getting how to create such kind of shock wave effect…
Please give me some idea and help me…
Thanks in advance for your support…
Take a look at [Physics.OverlapSphere()][1]. There is an example ExplosionDamage() function in the reference that can easily be modified to delete the game objects rather than just sending them a message.
If you want a shock wave such that nearer object get destroyed first, you can use the optional second parameter in the Destory() function that specifies the time. The code might look like:
float delay = (hitColliders<em>.transform.position - transform.position).magnitude * time_factor;</em>
Destroy(hitColliders*.gameObject, delay);*
_*[1]: http://docs.unity3d.com/Documentation/ScriptReference/Physics.OverlapSphere.html*_