- Home /
Explosive like in COD 4?
Hi, in the level that I'm working on at the moment you have to plant an explosive on something ,but I don't know how to do that, does anyone???
Answer by Peter G · Feb 13, 2011 at 02:19 PM
Steps:
Create you explosive model.
Create your particle effect and prefab it.
Delete the particle effect in the scene. :)
Create a script that places an explosive. It has to provide a position and rotation, unless you are planting on the ground, then only a position.
Call this function from the previously mentioned script.
var explosive : Transform; var explosion : Renderer; //Particle Prefab goes here.
function PlaceExplosive (position : Vector3, rotation : Quaternion = Quaternion.Identity, time : float) { var detonator : Transform = Instantiate(explosive, position, rotation) as Transform;
yield WaitForSeconds(time);
Destroy(detonator.gameObject);
Instantiate(explosion, position, rotation);
}
Your answer
Follow this Question
Related Questions
Simple crosshair script 1 Answer
script for animation play 1 Answer
Animation Not Playing 1 Answer
GUI Scale Problem 1 Answer