x


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???

more ▼

asked Feb 13 '11 at 12:10 PM

joeybubble1 gravatar image

joeybubble1
55 14 19 30

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Steps:

  1. Create you explosive model.

  2. Create your particle effect and prefab it.

  3. Delete the particle effect in the scene. :)

  4. 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.

  5. 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);
}
more ▼

answered Feb 13 '11 at 02:19 PM

Peter G gravatar image

Peter G
15k 16 44 136

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3337
x1175
x350
x161

asked: Feb 13 '11 at 12:10 PM

Seen: 731 times

Last Updated: Feb 13 '11 at 02:11 PM