#Particle Trigger Not Working

1 messages · Page 1 of 1 (latest)

woven dew
#

What I am trying to do:-

  • I have two objects, Duck and Poop. Poop has a particle system attached to it.
  • When Duck comes in range of Poop, I enable the particle system in the Fartoof script
  • After the particle system is enabled, the vfx plays
  • If the Duck and Vfx overlap, I want "Particle Collision Detected." to be displayed, but that does not happen.

I have tried checking Collisions and Trigger, unchecking Collisions and checking Trigger and checking Collisions and unchecking Trigger in the Particle System menu, but none of them detect any sort of collision.
https://paste.ofcode.org/38XgvqU7h4PweN3mqSEiXrH

lethal venture
#

ok now why would you share your code like this

#

!code

surreal mauveBOT
woven dew
#

one link can't have two scripts...

lethal venture
#

also why does that second screenshot look unconfigured

lethal venture
#

🤔 you sure the particle system triggers work with physics2d?

#

or if it does, make sure it's set to work with physics2d

woven dew
#

the ontriggerenter2D is not for the particle system, it is for another collider which detects whether the duck is in range which then enables the particle system

lethal venture
#

i'm not referring to it

#

i'm referring to the fact you're using Rigidbody2D and Collider2D

woven dew
#

on the duck?

lethal venture
#

the text in the docs you screenshotted and deleted kinda sound to me like it's for Physics (3D)

#

since "Collider" is capitalized

#

but i'm not sure, since the APIs don't use either Collider2D or Collider in their signatures

#

(and since i don't have any experience with particle system)

woven dew
#

doesn't specifically say what kind of colliders, only colliders

woven dew
lethal venture
quartz dew
#

alright, so i dont know particles either, but i am ... ok now, i see the component attached to the poop object, but isn't that different than the particle?

lethal venture
quartz dew
#

the component needs to be attached to the particle right

#

ok

woven dew
lethal venture
#

the thing is, the API just takes a Component. so maybe you could add collider2ds to it?

#

you would not do that in this scenario

#

i don't think you quite understand it tbh

quartz dew
#

i dont, and if you got this, i will step out :)

lethal venture
#

i definitely do not but there hasn't been any other answers so i'm just going with docs ngl

#

the docs don't have a demo of the UI so i'm absolutely going blind in that regard lol

quartz dew
#

i will lurk, and help if available

#

yes, both the duck and particle needs the collision component

#

if poo is just an emitter it doesnt need the collision

lethal venture
#

the possibilities afaict from docs would be -

  • particle system only supports 3d physics
    • -> you could use 3d colliders
    • -> you could have a separate 2d collider that you use for detection instead
  • particle system does support 2d physics
    • you would have to add the 2d collider explicitly, or maybe from code.
lethal venture
quartz dew
#

yeah, just restating that the poo object doesnt need the collider, only the particles

lethal venture
woven dew
woven dew
quartz dew
#

what I would do

#

is

#

have a start() in your particleclass (particlecollisionscript)

#

add a Start() and in that, check for the collision component

#

you can add a debug.log to see if it already has one or not

#

if it doesn't, add one

#

im just talking out my butt (ha) but that is what i would start with.

woven dew
#

go on, explain it completely

quartz dew
#

because i'm guessing you can't select individual particles when the game is running to check? not sure.

#
{
    if (!GetComponent<Collider2d>())
    {
        Debug.Log("no collider");
        AddComponent<Collider2d>();
    }
    else
        Debug.Log("already has collider");
}```
#

something like this?

woven dew
#

there are basically gonna be two collision checks, one for finding out when the duck is in range, the other for when the fart aoe hits the duck.

muted fjord
#

Just to confirm, you are only testing this with the one Duck object you've set in the trigger module, right? Not any clones?

quartz dew
#

oh, ok then, poop still needs a collider, got it

woven dew
#

wait a sec

muted fjord
#

Yeah that's the issue. It only works with the specific colliders you tell it to work with

quartz dew
#

yeah, and also, not sure about 3d, but oncollisionenter2d and ontriggerenter2d are 2 different things, if its a trigger, it wont be detected by the first one

woven dew
#

i guess i will just keep on adding these cloned duck colliders to the particle component's collision's collider list during runtime or smth?

quartz dew
#

nice!

woven dew
#

guy is absolutely goated

quartz dew
#

i'm glad they were able to help, and sorry if i was confusing :P

woven dew
#

np i have done that too, i got hound out by others because of it too, better to just stay quiet in these scenarios

#

i got hounded by boxbox before xD

quartz dew
#

🤐

woven dew