Jump to content

particleSystem autoStart (PR suggestion)


DigiHz Data
 Share

Recommended Posts

It seams that all particleSystems in a .babylon scene file is automaticly started.

 

ParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl) {

.....

particleSystem.start();

.......

};

 

This is great, BUT.....sometimes we do NOT want all the particleSystems to start when the scene loads!

So we should add an option to the particleSystem:

In function ParticleSystem(name, capacity, scene, customEffect) {

.....

this.autoStart = true;

.....

}

(true as default value, but the user can set this to false and then this particleSystem will not start when the scene is loaded, the user want to start this particleSystem manually later in his code.)

 

In ParticleSystem.prototype.serialize = function () {

.....

serializationObject.autoStart = this.autoStart;

......

};

 

In ParticleSystem.Parse = function (parsedParticleSystem, scene, rootUrl) {

....

particleSystem.autoStart = parsedParticleSystem.autoStart;

if (particleSystem.autoStart){

    particleSystem.start();

}

.....

};

Link to comment
Share on other sites

Ignore/delete my post, here.  I thought I had an easier answer, but then I woke up and noticed that the topic was about particle systems that are instantiated by .babylon file imports.  At first, I thought we were talking about local particle systems.  Sorry.

I WAS thinking...  hey... http://playground.babylonjs.com/?12 ... just include/discard line 68 for full control.  But noooo...  Wingnut, that's not the subject.  (Wingnut runs for more coffee and some duct tape for his mouth.)  :)

Link to comment
Share on other sites

Temechon:

I do not know how to actually do a PR. I am nt a member on github. But hopefully RaananW  or Deltakosh will do a proper PR about this.

Wingnut:

Yes you missed the whole idea :)

ALL particleSystems autostart from a .babylon scen file when we load it!

That is not allways what we want. Maybe we have 3 particleSystems in the scene, but we only want 1 of them to autostart when the scene loads, the other two we want to start manuall in the code.

Link to comment
Share on other sites

To prevent breaking changes I would have introduced a "preventAutoStart" variable. Then if it is set the parse method won't start the system. This way we don't need to change all previous scene files to oxide auto start.

But I like it a lot! I can do that later today.

Link to comment
Share on other sites

  • 7 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...