Question by
Memzz · Nov 19, 2021 at 09:35 PM ·
particle collision
Help with 'TriggerSubEmitter'
Hi guys below is my script for detecting particle collisions. The problem is that the 'triggerSubEmitter' function triggers sub-emiiters for all instances of the bullet particles.
Is it possible to only fire the sub-emitter for the instance that collided.
[SerializeField]
ParticleSystem ps;
List<ParticleCollisionEvent> collisionEvents;
private void Start()
{
collisionEvents = new List<ParticleCollisionEvent>();
}
void OnParticleCollision(GameObject other)
{
int _collisions = ps.GetCollisionEvents(other, collisionEvents);
int i = 0;
while (i < _collisions)
{
if (other.CompareTag(en) || other.CompareTag(hs) || other.CompareTag(bs) || other.CompareTag(ls))
{
ps.TriggerSubEmitter(5);
ps.TriggerSubEmitter(6);
ps.TriggerSubEmitter(7);
other.transform.root.gameObject.GetComponent<Enemy>().Implode();
}
else
{
ps.TriggerSubEmitter(2);
ps.TriggerSubEmitter(3);
ps.TriggerSubEmitter(4);
}
i++;
}
}
}
Thanks in advance :)
Comment
Your answer
Follow this Question
Related Questions
Disabling the particle 1 Answer
How to instantiate a (different) particle system on particle collision and at the collision location 0 Answers
Using OnparticleCollision noob problem 1 Answer
Detect Color in If Statement 0 Answers
Disabling the bouncing of particles when colliding + ignoring trigger colliders 1 Answer