- Home /
Why is ParticleCollider's intersection always zero?
I put this on a particle emitter with collision on:
public ParticleSystem part;
public ParticleCollisionEvent[] collisionEvents;
private void Start(){
part=GetComponent<ParticleSystem>();
collisionEvents=new ParticleCollisionEvent[16];
}
void OnParticleCollision(GameObject other){
int safeLength=part.GetSafeCollisionEventSize();
if(collisionEvents.Length<safeLength)
collisionEvents=new ParticleCollisionEvent[safeLength];
int numCollisionEvents=part.GetCollisionEvents(other,collisionEvents.ToList());
for(int i=0;i<numCollisionEvents;i++)
Debug.Log("Intersection at: "+collisionEvents[i].intersection);//(0,0,0)
}
The object is correct; it's not reflecting the intersection world coordinates. Something to check?
It might be the way your code is being formatted when reading on my phone, but how does that even compile? You appear to be declaring public ParticleSystem part;
from within the OnParticleCollision method?
Left that in while pasting. I edited it out; thanks.
Answer by kobechenyang · Jul 05, 2017 at 08:47 PM
part.GetCollisionEvents( GameObject ... this gameobject should be the gameobject particles are getting collision with. Say object A has particles on it. then you should use part(from Object A).GetCollisionEvents( object B, ...)
Your answer
Follow this Question
Related Questions
How to make OnParticleCollision affect multiple GameObject 1 Answer
Particles causing a weird effect on the surface they collide with 0 Answers
OnParticleCollision Question (Image included) Particle Decal Hanging off Edge 1 Answer
Is it possible to make a particle system solid??? 2 Answers
Adjusting OnTriggerEnter2D() for OnParticleTrigger() 0 Answers