OnTriggerEnter with Particle Collider
Hello, I have a Particle System with Collision, here is screenshot: basically it's just a sphere.
I have a GameObject with a CapsuleCollider which is trigger with OnTriggerEnter function:
void OnTriggerEnter (Collider other)
{
if(other.tag == "Particle") {
Debug.Log("Hit by Particle");
}
}
GameObject on which particle is attached has a tag "Particle". The problem is that this doesn't work. Particle collision never triggers capsule collider. I tried without a gametag, still the same. I know that I can use OnParticleCollision()
but I need to detect collision on other gameobject, not on the gameobject on which particle is attached.
Having the exact same problem right now with Unity 2018.3.2f1
I would not be surprised if it is not supported by Unity : (
2D particle collision seems to work perfectly well with what Im doing as seen here:
https://gfycat.com/SameAssuredHairstreakbutterfly
The bricks just have 2d box colliders and a script on each that gets the OnParticleCollision() call back. I have not been able to check the IsTrigger box to get the onTriggerEnter call back though for each of the bricks:
Answer by da_zerker · Feb 02, 2019 at 06:33 PM
Hope this can help. In Particle settings => Collision turned on => Type set to World= > Send Collision Message checked. With Triggers turned on.
private void OnParticleCollision(GameObject other)
{
bool special = false;
switch (other.tag)
{
case "NormalFire":
hitDamage = 1;
break;
case "SecondaryDamage":
hitDamage = 5;
break;
case "SpecialFire":
hitDamage = 10;
special = true;
break;
default:
break;
}
,Hope this helps. With Collision on, set to World, and Send Collision Message. With Trigger on also.
private void OnParticleCollision(GameObject other)
{
bool special = false;
switch (other.tag)
{
case "NormalFire":
hitDamage = 1;
break;
case "SecondaryDamage":
hitDamage = 50;
break;
case "SpecialFire":
hitDamage = 10;
special = true;
break;
default:
break;
}
Your answer
Follow this Question
Related Questions
Start collision detection of particles after certain time 0 Answers
The collision of game objects are often fail and occasionally success 1 Answer
Little dust particles after player jump hitting ground 2 Answers
Unity Particle Collision not working 0 Answers
Lose Health when GameObject enters collider? (OnTriggerEnter) 2 Answers