How to make particles collide with something but at the same time phase through it

Description

I am currently making a Unity game where I have an entity which fires a laser blast and I am currently using a Particle System. However, every time I try to mess around in the Collision settings, I can’t seem to find a way on how to make the Particles detect a collision on a specific gameobject but at the same time, allow the particles to travel through it.

Details

I am using OnParticleCollision() to detect when the particles are actually hitting the object with this code:

void OnParticleCollision(GameObject other)
    {
        if (other.name == "name")
        {
            Debug.Log("Working!");
        }
    }

The actual script is also attached to the gameobject which produces the Particle System. Like I said before, when I tamper with the Collision settings, the only time I get it to detect the collision and show the “Working!” log message is when the particles actually bump into the object whereas I want the actual collision to be detected but at the same time, the particles phase through.

If these are not enough details, I will gladly add more. All you have to do is ask. :slight_smile:

P.S. I also searched all over the web to try and find something but no luck… and sorry if this is a newbie question or I did something wrong. I am a bit new here.

It seems I have answered my own question. Instead of using the Collision module, the actual behaviour I’m seeking could only be provided by the Triggers module in the Particle System component.

What I did was, I enabled the Triggers module, specified the Collider and set the Enter value to Callback which enters the function OnParticleTrigger() when a particle encounters the Collider specified.

This is the code which made it fully functional:

    public ParticleSystem ps;
    List<ParticleSystem.Particle> enter = new List<ParticleSystem.Particle>();

    // Use this for initialization
    void Start () {
        ps = GetComponent<ParticleSystem>();
    }

    void OnParticleTrigger()
    {
        int numEnter = ps.GetTriggerParticles(ParticleSystemTriggerEventType.Enter, enter);

        for (int i = 0; i < numEnter; i++)
        {
            ParticleSystem.Particle p = enter*;*

//take damage
enter = p;
}

ps.SetTriggerParticles(ParticleSystemTriggerEventType.Enter, enter);

Debug.Log(“Working!”);
}
Hope this helps whoever stumbles upon the problem I encountered! :slight_smile:

I’m encountering a similar issue. I want my game object to recognise collisions/triggers of particles but I need “is trigger” to remain on for the rigid body of my Game object or it can’t move correctly.

I’ve tried using the script above and attaching it to the Game object, removing line 6 and then adding the particle system in the scene editor.

Zilch, sadly. it’s not registering. Any ideas? @andracer108