Jump to content

Reverse Particle System


pichou
 Share

Recommended Posts

Hello this is kind of possible if you use the custom update functions: http://doc.babylonjs.com/tutorials/particles#custom-functions

The startPositionFunction can be used to spawn particles everywhere and the updateFunction can be used to compute the attraction.

Here is an example of custom functions: https://www.babylonjs-playground.com/#15HSI4#1

 

 

Link to comment
Share on other sites

Hey deltakosh,

Here is a playground of the reverse particles system : https://playground.babylonjs.com/#PSK6N1
Hope it could help other developers.

Maybe there could be an option in the BABYLONJS particles system where you define the behavior of the emitter : emit or attrack particules. But the custom function do the job perflectly here.

Cheers, Pichou
 

Link to comment
Share on other sites

Very cool, Pichou!  You too, DK!

Umm... I see that Jerome is lurking-around, too.  So, let's see... a reversed SPS (solid particle system) using lots of different meshParticle shapes... with a little rotation and centrifugal-simulating... could look like a black hole gravity-well... like water swirling down a drain... sucking-up planets and stars.  Coooooool.  :)

Demented particle experiments... gotta love 'em!  Perhaps it is time for Babylon.Tools.Mesh.ForceFields.Attractor()  (and Expander/Exploder)  (and Container, too, which Jerome has already done).  Like a 3dsMax FFD space warp box... but for worldspace/positions instead-of localSpace/verts.  Interesting!  (or not)

"Leaf treatments".  :)  You can blow a leaf, suck-up a leaf, or put a box over it.  You can burn it, too, but we'll talk about that, later.  BabylonJS is not ready for mesh fires, yet.  :D  Flammability, conductivity, lightningStrikeSusceptibility, combustibility, verticeMeltingPoint, lots of new props needed, yet.  heh

(Wingy grabs a bucket of weighted vertices and heads-out to a muddy swamp... to see if they sink.)

Link to comment
Share on other sites

  • 1 month later...

Hey guys,

Can you tell me what is the frame rate of the updateFunction of particles? 60 FPS I guess?

The emitRate is the number of particles created in 1 second or something like that?

And the unity of the particle's age is in seconds?

I need to be very accurate on one of my partcles system ;) 

Thanks

PS : maybe those questions could be answered in the particles doc page https://doc.babylonjs.com/babylon101/particles

Link to comment
Share on other sites

So:

-updateFunction is called once per static frame time

- emitRate is the number of particles generated per static frame time

- Age is in static frame time (but the updateSpeed property can change it)

 

static frame time is running at 60fps (even if the rendering is not at 60fps)

 

Here is the relevant code:

https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.particleSystem.ts#L194

_scaledUpdateSpeed is compute like this: this.updateSpeed * animationRatio: https://github.com/BabylonJS/Babylon.js/blob/master/src/Particles/babylon.particleSystem.ts#L426

AnimationRatio is build like this:https://github.com/BabylonJS/Babylon.js/blob/fb232eca8e296b7cec94edc04b15fe3479638568/src/babylon.scene.ts#L3399

So at 60fps the scale is 1

 

Also: would love to get some help improving the doc if you have some free time:)

Link to comment
Share on other sites

Hey deltakosh,

Thanks for the particle details.

I am very flattered you ask me for help on the doc considering the fact that I have been working with babylonjs for only three months now! 

But I am not sure if I know the babylonjs library enough to do that. I mean I could easily misunderstood some points as I really don't know how the core engine of babylon works.
What is it you need help with in the doc exactly?

Pichou

Link to comment
Share on other sites

This is EXACTLY why I need your help :)

I know the engine far too much to be able to create content for beginners. You on the contrary went through this learning curve. So everytime you find something missing in the doc please let me (or  @JohnK or @Wingnut) knows

If you want you can edit the current pages here

https://github.com/BabylonJS/Documentation/tree/master/content

and add more details

 

No worry btw as we will review all changes before committing them to the repo

Link to comment
Share on other sites

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...