- Home /
Destroy cube on collision
Hey guys could any of you help me with this? i want my cube to destroy after another cube touches it? here's a little video explaining what i mean and what i've tried if you take a second to watch?
Answer by drjd24 · May 15, 2013 at 07:04 PM
use rigid colliders and write a small script saying that when gameObject Box1 is at the smae position as gameObject Box2 use destroy.gameObject command
in javascript that it :o
-Jordan
I do that say if but "box1.transform.position.y == box2.tansform.position.y" say box 2 y = 12 if i go to y12 anywhere on the map it destroys the cube i only want it if it touches cube 2
Either use raycast and make it only extend to the outside of the cube and use the x-axis and y-axis of the cubes. Or use OnCollisionEnter or OnCollisionStay in your script
Also, you can send me your scene; or a mock up; and i could try and make a solutions to it, but dont take my word on it :P i might not be able to fix ita
-Jordan
Is it okay if I send it tomorrow I'm in bed right now jordan, you can add me on skype "mitch.wardle97" I can speak to you there! Thanks for the help!