Cloned particle system auto-starts

https://playground.babylonjs.com/#IPJDQG#1

Just noticed this, is this the intended behavior? When cloning a particle system that hasn’t yet started, the clone seems to auto-start.

1 Like

Let me take a look …

It does start, no matter if you ‘force stop’ the main before hand. Not sure this would not require a small fix. It seems odd to act this way, even if the go-around is easy.

Looking at ParticleSystme source code Line 2133 I can see that cloning is done with

var result = ParticleSystem.Parse(serialization, this._scene || this._engine, this._rootUrl);

now… Parse() method is the one that takes an optional parameter doNotStart?: boolean as described in documentation for ParticleSystem.Parse().

@Cedric It seems param is optional and currently I can’t find a way to pass that from clone() level.

@blindinghues I would suggest you manually stop it after cloning until it is corrected :wink:

2 Likes

By default, cloned particles system start.

But you can prevent that by setting :

particleSystem.preventAutoStart = true;

Then, cloned particle system won’t start.

Fixed PG:
clone issue | Babylon.js Playground

2 Likes

@MarkBevels , I think you got it.
Just tried this:
var particleSystemCloned = particleSystem.clone(“particles2”, 1);

https://playground.babylonjs.com/#IPJDQG#3

and it does work, I believe…

Edit: you do not need to force stop the initial particle system. It is a remain of my old attempt :wink:

3 Likes

AMAZING and thanks @mawa and @Cedric. Makes sense!

1 Like

It is you who gave us the solution (and took the time to look back at the code, so…) Thank You! :smiley:

No worries @mawa. I started using babylonJS for my sci-fi game and already got amazing amount of help from you guys so trying to make myself useful where I can. :smiley: Spending my coffee breaks on the forum to rest from my code and learn.

2 Likes

@Cedric , lol, thanks for that.

that’s even better. Now, we even have a choice :smiley: Isn’t life just beautiful with BJS :smile:

1 Like

That’s an excellent mindset @MarkBevels ! So happy to have you part of the community

Yes it is! :heart_eyes:

Happy to be here @Cedric . You guys do the hard work, we just rip the benefits. :nerd_face:

1 Like

we sure do :grin:

1 Like

Wow what a flurry of activity, thanks everyone! This is indeed an amazing community :relaxed:

1 Like