Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Particle Trigger Collision

Discussion in 'Scripting' started by Osteel, Mar 6, 2015.

  1. Osteel

    Osteel

    Joined:
    Jan 17, 2014
    Posts:
    59
    Hi!

    I have a question about particle collision detection. I've looked a bit online and there seems to be confusing information regarding Legacy and Shuriken and how to do particle detection.

    I have a helicopter that is being chased by a missile. The chopper can shoot flares, and I would like the missile's massive trigger collider to recognize whether it has collided with a particle. From there, I should be able to easily apply a new target on the missile.

    I tried putting OnParticleCollision() on the missile, but it returns nothing. I've also tried tinkering with the Collision field in the particle system, and by setting the layer to Missiles.

    Does anyone have any insight on this?

    Thanks. :)
     
  2. tawdry

    tawdry

    Joined:
    Sep 3, 2014
    Posts:
    1,356
    I had a issue with this a few days back. If u are using shurikan do not use world particle collider in the particle menu itself click on collision field which will give u a dropdown menu.Tick the send msg box in it and that should do the trick.

    https://www.flickr.com/photos/129989537@N04/16480064640/

    Script can be attached to the particle itself or the object been hit the object hit must have a collider.
    Attach this script if u like to test that its working.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. public class particlehit : MonoBehaviour {
    4.     void OnParticleCollision(GameObject other) {
    5.         Debug.Log ("hello");    Debug.Break ();
    6.     }
    7. }