Madclaws Posted November 27, 2018 Share Posted November 27, 2018 Hi guys, A babylon noobie here ,I am trying to get a simple burst particle effect like this https://phaser.io/examples/v2/particles/click-burst. But sadly i could only do this much .https://www.babylonjs-playground.com/#5EGWMF#51(on colliding with first cube ,i should get the effect like above link).There are so many params for particle system to tweak. Thanks. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 27, 2018 Share Posted November 27, 2018 You can use particleSystem.manualEmitCount = 300; instead of emitRate which emits continously: https://www.babylonjs-playground.com/#5EGWMF#53 DylanD and Madclaws 1 1 Quote Link to comment Share on other sites More sharing options...
Madclaws Posted November 29, 2018 Author Share Posted November 29, 2018 @Sebavan Thanks for that tip.Is there any way such that when the first box hits the third box,the same particle animation should run at third box's position. What i am doing is ,setting targetStopDuration to 1 and then on hitting third box i am calling particleSystem.start() again .But that's not working. Modified PG link below https://www.babylonjs-playground.com/#5EGWMF#57. Thanks. Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 29, 2018 Share Posted November 29, 2018 Adding @PatrickRyan who played a lot with the new particle system lately ? PatrickRyan 1 Quote Link to comment Share on other sites More sharing options...
PatrickRyan Posted November 29, 2018 Share Posted November 29, 2018 @Madclaws I took a look at your playground and added a couple of things for debug. The first was to play the particle system on key press (spacebar) so that I don't have to rerun the scene every time to see what is happening. The second is that I commented out your manualEmitCount line as that will never allow more particles to spawn than the ones it spawns. It essentially says "emit only X particles all at once" which is why when you call start again nothing happens. You've already hit your particle limit on that system. I normally never use manualEmitCount just because of that limitation unless I am instantiating a system to be destroyed right after it's done. If you want a system that hangs around that you can turn on and off, you want to couple a high emitRate with a low targetStopDuration. This will simulate a burst, but you can time the emitRate to give some more pleasing gradients of speed than you get with a burst. Now your particle system plays when you reach each point or when you hit space, but it looks like your code needs a little massaging because the second collision continues to happen even after the cube is gone. To fix this I added a second isDestroyed boolean to prevent the particle system from running again like you do with your first collision. Let me know if you have more questions! Take care. https://www.babylonjs-playground.com/#5EGWMF#59 Madclaws 1 Quote Link to comment Share on other sites More sharing options...
Madclaws Posted November 30, 2018 Author Share Posted November 30, 2018 @PatrickRyan Thank you very much for explaining the solution in detail and for the tips about particle system.This is what i need.Thanks a lot.I have one question ,the images that i use for particles have alpha mask (obviously).But in game these alpha masks are visible .I tried different images but still result is same.Any clue regarding this? Screenshot attached. Quote Link to comment Share on other sites More sharing options...
jerome Posted November 30, 2018 Share Posted November 30, 2018 yourTexture.hasAlpha = true; Quote Link to comment Share on other sites More sharing options...
Madclaws Posted November 30, 2018 Author Share Posted November 30, 2018 @jerome There is a typo in your answer yourTexture.hasAlpha=true; But setting to true not working for me. Quote Link to comment Share on other sites More sharing options...
jerome Posted November 30, 2018 Share Posted November 30, 2018 thanks, fixed... no idea why, then Quote Link to comment Share on other sites More sharing options...
Sebavan Posted November 30, 2018 Share Posted November 30, 2018 @Madclaws Could you share a repro ? This should work PatrickRyan 1 Quote Link to comment Share on other sites More sharing options...
PatrickRyan Posted November 30, 2018 Share Posted November 30, 2018 @Madclaws, the most likely issue here without seeing a playground is you did not set a blendMode on your particle system. If a blendMode is not set the default is BLENDMODE_ONEONE which ignores the alpha of your texture for more performance in your system as there is no overdraw. To get alpha you need to use: particleSystem.blendMode = Babylon.ParticleSystem.BLENDMODE_STANDARD; You can learn more about the available blendMode options at https://doc.babylonjs.com/babylon101/particles#particle-blending. To help you out a bit I converted the particle demos from our release video into a playground so you can dig in and play with the code to see how we normally set up particle systems. Make sure you focus on the canvas (click on it) and press space bar to iterate through the systems. I usually set up demos like this so I have control over repeating the system so I can evaluate the interactions of the particles and tune the variables. Let me know if you have more questions. https://playground.babylonjs.com/#US7JSP GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
Madclaws Posted December 4, 2018 Author Share Posted December 4, 2018 @PatrickRyan Tried that one also ,not working? Quote Link to comment Share on other sites More sharing options...
PatrickRyan Posted December 4, 2018 Share Posted December 4, 2018 @Madclaws can you post a playground for us to look at, even a partial one with the particle system only would help. Taking wild guesses at what is happening will just waste your time so looking at the code will produce the fastest solution. Thanks! Quote Link to comment Share on other sites More sharing options...
Madclaws Posted December 7, 2018 Author Share Posted December 7, 2018 Hi guys, Sorry for the mess,that was an image issue rather than babylon's .Noobie reloaded? Thanks all. 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.