x


Emitting Particles on Collision

Hello all, I know this question has been asked and answered many times. I've looked through many of them and the documentation and I still cannot solve my problem. So basically I have a bullet object and when it collides with another object, I want it to emit a particle on the position of the object the bullet hit. Here's my current code:

var hitParticles : ParticleEmitter;

function OnCollisionEnter (collision : Collision) {
var contact : ContactPoint = collision.contacts[0];
var rotation = Quaternion.FromToRotation(Vector3.up, contact.normal);

if(collision.collider.tag == "HitObject") {
Instantiate(hitParticles, contact.point, rotation);
}

I know the objects are colliding correctly because the print statement tells me it is, but the particle is not emitting at all. I have this script attached to my bullet object. Can someone give me an idea what I might be doing wrong? Thank you!

EDIT: Of course five minutes after I ask I figure it out. I updated the code in case anyone else is having this problem.

more ▼

asked Aug 12 '12 at 06:41 AM

ObviouslyInsane gravatar image

ObviouslyInsane
43 18 23 25

post it as answer to close question.

Aug 13 '12 at 08:54 PM ScroodgeM
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
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:

x2484
x318

asked: Aug 12 '12 at 06:41 AM

Seen: 480 times

Last Updated: Aug 13 '12 at 08:54 PM