- Home /
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!
Answer by Eric5h5 · Feb 08, 2010 at 03:09 PM
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.
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.
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.
Your answer
Follow this Question
Related Questions
How to block collision between selected objects 0 Answers
Problem with Collider 3 Answers
Punching a crate 0 Answers
how do i correctly use a box collider 0 Answers
How to detect collision between two objects from a separate script? 1 Answer