x


Particle Collision / Trigger not being reported to On_xx Event

I'm running this code:

var weaponOne : ParticleEmitter;
var puffOne : ParticleEmitter;

function OnTriggerEnter (weaponOne) {
    Debug.Log("hit!");

    var clone = Instantiate(puffOne, transform.position, Quaternion.identity);
    clone.emit = true;
    Destroy(weaponOne.particles);
}

This is on a particle system (bullets) that hits a rigidbody, and I want it to spawn another particle system at the same place (poofs).

I've also tried OnCollisionEnter and OnParticleCollision, but I think the Trigger would be best, perhaps. I was under the impression that OnParticleCollision, that works best on rigidbodies trying to detect whether they're being hit by a particle, i.e. so that it knows to be damaged.

So far, the Debug text doesn't even appear in the Console log, so I'm pretty much at wit's end on this issue. TIA!

more ▼

asked Feb 08 '10 at 02:44 PM

CryptoQuick gravatar image

CryptoQuick
57 6 8 13

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

1 answer: sort voted first

A particle system can't be a trigger; it will only generate OnParticleCollision events. OnParticleCollision doesn't have collision location information anyway...you'd be better off raycasting and using particles as visual elements only.

more ▼

answered Feb 08 '10 at 03:09 PM

Eric5h5 gravatar image

Eric5h5
80.1k 41 132 519

Thanks for the suggestion, that sounds about right. Do you know of any good resources on raycasting other than what's in the scripting API? I'd like to know more about how that works exactly.

Feb 09 '10 at 02:29 PM CryptoQuick

If you mean raycasting in general, I'd suggest googling it, since it's nothing unique to Unity. If you mean the Unity-specific implementation, various tutorials have raycasting in them, like the first-person shooter tutorial.

Feb 09 '10 at 08:12 PM Eric5h5

Thanks, man. You get the answer. :)

Feb 11 '10 at 04:17 PM CryptoQuick
(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:

x2482
x1682
x636
x172
x166

asked: Feb 08 '10 at 02:44 PM

Seen: 2221 times

Last Updated: Feb 08 '10 at 02:44 PM