|
Hi I am using the detonator kit from Unity. I am trying to make a car explode. My question is that, the moment after I explode the car, how can I replace the car with a burned one? Thanks.
(comments are locked)
|
|
Ok this is very simple to do actually. You need to place a life component on your car. Here is the script for that.
Ok here let me explain a little. The hitpoints is how much damage it has taken. Or life. So if you shoot it or throw a grenade or what ever and it reaches 0 then it explodes. So put it on the car, make sure there is a collider on it. Now create a empty gameObject and put it on the same position it is for the car. Rename it ExCar1, duplicate the script and rename the EXCar1 to EXCar2 anf make another gameObject called EXCar2. Now if you want, that that if you shoot it enoough times it will catch fire on the engine this is pretty easy as well. So create a new if statement under the instantiate part.
Ok now this function checks if it only has 30 life left and then it will find a gameObject called Fire1S, The S stands for Spawn. Create a empty gameObject and name it Fire1S. Place it where the engine is. Also create a new variable called var FirePrefab : Transform; and the transform should be fire particles. This should work for you and make sure that your weapon can apply damage.
(comments are locked)
|
|
Destroy the car, Instantiate a burned car. http://www.unifycommunity.com/wiki/index.php?title=OnCollideExplode
(comments are locked)
|
I attach this to the car or to the detonator?
Mar 21 '11 at 08:49 PM
Michael 20
insert in the cars existing script
Mar 21 '11 at 09:20 PM
AngryOldMan
(comments are locked)
|
