Delete living particles

#1

Hi there,

when changing “context” in the game I would like to delete all living particles. If I merely delete the emitters the living particles still continue their normal lives. For the moment I set the emitters tint to (0, 0, 0, 0) before I delete it.

Of course this cost a drawcall for each emitter since I am changing an emitter constant.

Is there a better way to achieve this? If no, could perhaps this be added to the api in a near future?

Thanks a lot as usual for your help and time!

0 Likes

#2

Unloading the collection should remove the particles.

0 Likes

#3

Ah! This sounds strange to me.

The emitter is a component of a go of a collection dynamically loaded. I am setting the tint to 0 in the final method of the controlled attached to the go. I call unload on this collection but I don’t call delete on the go. Without setting the tint to 0 the (already emitted) particles complete their normal lifetime.

Is the described particle behaviour fine?

0 Likes

#4

Ah, so not a collection proxy? My suggestion only works if you unload the proxy

1 Like

#5

@britzl thank you for your reply; now I understand.

However I have to admit I am somehow confused by collectionproxy’s. I have read the manuals but I don’t really see the difference between (1) collectionproxy and (2) dinamically loaded collection.

Moreover, given the following scenario, what is the best choice?

In the level selection phase there are various “rooms” the player may navigate in. This selection phase has some common elements (the player, some interface elements…); but each room has its own collection. At the moment I am not using collection proxy but dinamically loaded collection.

Thanks!

0 Likes

#6

A collection proxy can load and unload a single instance of a collection. You cannot use it to load it twice to get two instances at once. The game objects in the loaded collection exist in their own world and can’t interact with game objects from another collection proxy. Each loaded proxy creates a new physics world. You can change the time step of a collection proxy to create slow motion effects or pause it.

A collection factory that is dynamically loaded can be used to create multiple instances of the collection. The game objects of the collection exist in the same world and can interact.

2 Likes

#7

Thank you, now it is clearer to me.

0 Likes