pichou

Reverse Particle System

Recommended Posts

Hello,

I have made some research on the internet and on this forum but I didn't find any example of a reverse particles system.
The idea is to have a gravity point which attracts the particles instead of a emitter point which launch particles.

Is that possible with babylonjs?

Regards, Valentin

Share this post


Link to post
Share on other sites

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

 

 

Share this post


Link to post
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
 

Share this post


Link to post
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.)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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:)

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

OK Great I can do that! Happy to help the community! ;)

I will try to think of what information would be good to have when I am in a documentation page.

Is there a topic in this forum where I can share any improvement ideas or ask for details before suggesting a change on github?

Cheers

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.