onparticlecollision doesnt work with trigger colliders

is this a bug or what? this method call only works if the collider on the object is NOT is trigger. but thats really dumb and annoying, AND i WANT it to BE, “IS TRIGGER”. so thats even more annoying.

what can be done? is the only option to completely bypass this crap and just have another trigger collider enabled on the frames my item is “SHOOTING” out… ? and just try to have them line up with the particles being SHOT OUT?

THANKS ALL.

Whoa… that’s a lot of angst packed into one sentence.

Are you perhaps looking for OnParticleTrigger()?

You may wish to consider switching to a decaf brand. :wink:

LMAO. yeah i was excited last night when i SAW that on particle trigger, but it didnt work!!??

now youre telling me to TRY it AGAIN? im willing. but if i come back here b*tching and moaning you wont like it. although i’ll try to be as civil as possible.

WELP, still doesnt work. i tried it on both the particle system and the other game object.

is there some super special thing i should be doing? like that stupid TRIGGER section in the particle system that i have no idea what it means? or is it something else im missing?

this method wont even let me pass an OTHER object into it, so whats the point anyway if you cant even check what tag it is. and yes i have it in world space and 3d and collision enabled and all the stuff like that. so like i said it works with oncollisionenter as long as is trigger is OFF.

“OnParticleTrigger may not have any parameters”

is that a joke? how else am i supposed to detect a tag then? why the f**K is this any different than a normal physics interaction within unity? jeeez. man what the hell is wrong with this stupid program? i know everything there is to know about collisions in unity, including trying to put rigidbodies on the triggers, and they still dont work. why does something clearly equipped with colliders and tags and scripts just for some reason have to do their own thing. come on, unity. get your act together.

Wow, chill out.

The docs make it clear how the call back is to be used. Namely, on the same game object the particle system is on.

Particles don’t have any knowledge of the game object they came from. Looking at the docs it’s been that way since Unity 5. Bit late to be complaining, sorry.

you dont think i tried that or checked the docs? lol wut. u crazy?

Clearly I’m the crazy one because this:

[ExecuteAlways]
public class ParticleKiller : MonoBehaviour
{
    #region Inspector

    [SerializeField]
    private new ParticleSystem particleSystem;

    #endregion

    #region Unity Callbacks

    private void OnParticleTrigger()
    {
        if (!particleSystem)
        {
            return;
        }

        List<ParticleSystem.Particle> enteringParticles = new();

        int enterCount = particleSystem.GetTriggerParticles(ParticleSystemTriggerEventType.Enter, enteringParticles);

        for (int i = 0; i < enterCount; i++)
        {
            ParticleSystem.Particle p = enteringParticles[i];
            p.remainingLifetime = 0;
            enteringParticles[i] = p;
        }

        particleSystem.SetTriggerParticles(ParticleSystemTriggerEventType.Enter, enteringParticles);
    }

    #endregion
}

Worked totally fine for me. Video proof here: https://i.gyazo.com/d9717faaf46a088ddde2e9720b1a9831.mp4

If it wasn’t abundantly clear from the docs, the component that you want the trigger on has to be on the same game object as the particle system. You also need to assign the collider in the triggers module:

Hence why it doesn’t have any parameters, because the object that is triggering the callback is the same game object emitting the particles. There’s no need.

In future instead of getting angry at a problem, try direct your energy at solving it.

This was my first time using a particle system fyi.

but why is it your first time? thats weird. i use them all the time.

yes it was (somewhat) clear about the game object needing to be set in the triggers section (actually it didnt mention the need anywhere as i recall) (i did see it though in the particle system), but i dont know how to set that at runtime. if that is even possible. because i dont know ahead of time what particular prefab that will be just yet. you know?

maybe a workaround for this horrendous bug would be to add and remove the items to the trigger list at runtime, since a simple detection wont work without it. seems strange. its a bug, trust me. because you can see it bugs me.

Once again it’s all in the docs. You have access to the trigger module through the particle system: https://docs.unity3d.com/ScriptReference/ParticleSystem-trigger.html

It’s not a bug it’s just how it works, and how it has worked since as far back as Unity 5.

1 Like

that sounds like it might work, thanks. i’ll keep that in mind if the need arises again. for now im just turning on a cone trigger game object when “shooting”. probably more performant, but we’ll see considering im already still using colliders and world space 3d calculations anyhow.

next round i will try this again.