pichou Posted September 15, 2017 Share Posted September 15, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 15, 2017 Share Posted September 15, 2017 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 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
pichou Posted September 18, 2017 Author Share Posted September 18, 2017 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 Wingnut, Dad72, jerome and 1 other 4 Quote Link to comment Share on other sites More sharing options...
Wingnut Posted September 18, 2017 Share Posted September 18, 2017 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. 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.) pichou 1 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted September 18, 2017 Share Posted September 18, 2017 @pichou: Actually I plan to create a particles library where we could add as many behaviors as we want https://github.com/BabylonJS/Babylon.js/issues/2445 Dad72 and pichou 2 Quote Link to comment Share on other sites More sharing options...
Dad72 Posted September 19, 2017 Share Posted September 19, 2017 great idea Quote Link to comment Share on other sites More sharing options...
pichou Posted November 12, 2017 Author Share Posted November 12, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 13, 2017 Share Posted November 13, 2017 So: -updateFunction is called once per frame - emitRate is the number of particles generated per frame - Age is in second (but the updateSpeed property can change it) Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 13, 2017 Share Posted November 13, 2017 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:) pichou and Wingnut 1 1 Quote Link to comment Share on other sites More sharing options...
pichou Posted November 14, 2017 Author Share Posted November 14, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 14, 2017 Share Posted November 14, 2017 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 Wingnut 1 Quote Link to comment Share on other sites More sharing options...
pichou Posted November 14, 2017 Author Share Posted November 14, 2017 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 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted November 15, 2017 Share Posted November 15, 2017 Just start a thread here Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.