- Home /
Question by
jabirmoolur · May 04, 2016 at 01:15 PM ·
collision detectioncollision2dcollisions
detecting collision of collided object 2d
I have three 2d objects for during object one hits the object 2 if any objct3 touching on object2 i want to perform some action on object 3
i have scripts for each object
basically i what i want to achive is when object 1 touches object 2, if any object3 is in touch with object 2 at that time, i want to destroy those object3
Comment
Answer by nopogo · May 04, 2016 at 01:46 PM
If you want to utilise the unity 2d physics there are a few steps:
give each object a 2d collider component.
give the moving objects a rigidbody2d
check for collision in a oncollision2denter/oncollision2dStay function (http://docs.unity3d.com/ScriptReference/Collider2D.OnCollisionEnter2D.html)
The unity manual explains all this really well over at: