|
Hi i need help with how do i trigger an explosion for my rockets when the time is up instead of them just being destroyed. This is the code im using
I have downloaded the Detonator Package wich im trying to use for this... Thanks for your help.....
(comments are locked)
|
|
Just add a reference to a Detonator prefab (from the pack), fill it in using the Inspector, and then instantiate it. It should go off right away if you didn't mess with anything in the Detonator settings.
Then, before you destroy the object, do something like this: But what if you want the actual rockets (that im firing) to explode after the timeline that ive set to 2.7 seconds as you can see in the code. Right know when i tried your code the explosion takes place 2.7 seconds in to the game without me even having to fire the rockets
May 20 '10 at 10:57 PM
Marcus
You have to put the explosion on the rocket object, so when the rocket is fired and explodes, the explosion gets spawned. This code won't work if it's not "on" the rocket.
May 21 '10 at 12:13 AM
qJake
Ok now it works that when i press the shoot button the explosion and the firing of the rockets happens simultaneously, but i want that the explosion to occur at the end of the rockets "life cycle" when the rockets are destroyed. Sorry if i was unclear about what i needed..
May 21 '10 at 12:59 AM
Marcus
So just do what you already did for the rocket, except do it for the explosion (using Invoke).
May 21 '10 at 04:36 AM
qJake
Thank you i works now
May 21 '10 at 05:07 PM
Marcus
(comments are locked)
|

What's the question? Does this code not work? If not, what does it do? What did you expect it to do?
the question is how do i start a explosion when the rocket is destroyed instead of it just disappear.
@Lucas He wanted to know how to use the Detonator pack to instantiate an instance of one of the explosion prefabs that's included with the pack, though I agree, the question was pretty vague... took me awhile to decipher it. :P
sorry about that