Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  KillParticle after collision and shouldn't return
#2
I have created a work around for now.

public class StopEmitterMaxParticleCount : MonoBehaviour
{
    public Obi.ObiActor actor;
    public Obi.ObiEmitter emitter;
    public float maxParticleCount;
    public float particleCounter;
   
    public float emissionSpeed = 1;
    
    // Start is called before the first frame update
    void Start()
    {
        actor = GetComponent<ObiActor>();
        emitter = GetComponent<ObiEmitter>();
        emitter.speed = emissionSpeed;
    }

    // Update is called once per frame
    void Update()
    {
        
        print("actor.activeParticleCount = " + actor.activeParticleCount);
        //print("actor.particleCount = " + actor.particleCount);
        
        if(actor.activeParticleCount == actor.particleCount)
        {
            emissionSpeed = 0f;
            emitter.speed = emissionSpeed;
        }
    }
}


this in conjunction with my other script that kills the particle works for my purposes for now. Although I would like the ability of not needing to stop the emitter, rather just deactivating the killed particle at it's indices. This way if a barrel only spills some of its contents, it will still retain the ability of spilling the rest, however still allowing me to cleanup was has already been emitted and those particles not going back into the pool.

Once I have that setup I will post again. For now my prototype can move forward.
Reply


Messages In This Thread
RE: KillParticle after collision and shouldn't return - by adamgffrd - 27-09-2020, 03:51 PM