- Home /
Electric Shock Wave Effect 2d
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..
Answer by robertbu · May 25, 2013 at 05:56 AM
Take a look at Physics.OverlapSphere(). 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[i].transform.position - transform.position).magnitude * time_factor;
Destroy(hitColliders[i].gameObject, delay);
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
Creating 2D art in a 3D world 3 Answers
Isometric camera 2d or 3d 2 Answers
Particles/Additive Shader not showing in Android 0 Answers
Using 3D Particles in 2D Scene 2 Answers