DylanD Posted July 18, 2018 Share Posted July 18, 2018 Hey everyone I was wondering if anyone new how I could make my particle's colour be based of its spawn height. I think I need to do it in the start position function or update function but I don't know how I would go about doing that. Here is a playground where the height of the particle at start changes, how could I make it so the bottom ones are always blue and the top ones are always red? Any ideas? Quote Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2018 Share Posted July 18, 2018 Hello! you can easily achieve it with custom effect: http://doc.babylonjs.com/how_to/customise#custom-effects Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 18, 2018 Author Share Posted July 18, 2018 hmmm that seems a little crazy for what I need right now, so If there are other ways to do it I'm open to suggestions, but il try that.. I was also wondering is particleSystem.addSizeGradient in babylon 3.2 because I can't seem to use it... Thanks for the super quick response DK Quote Link to comment Share on other sites More sharing options...
Guest Posted July 18, 2018 Share Posted July 18, 2018 It is in the doc: http://doc.babylonjs.com/babylon101/particles#size (only for 3.3) dbawel 1 Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 18, 2018 Author Share Posted July 18, 2018 Sorry, I missed that. Guess I'm upgrading to 3.3 Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 18, 2018 Author Share Posted July 18, 2018 These gradients are great! Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 18, 2018 Author Share Posted July 18, 2018 I just noticed the original post did not have my playground in it... So here it is! http://www.babylonjs-playground.com/#U64HVU#5 Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted July 18, 2018 Share Posted July 18, 2018 Here's one way; http://www.babylonjs-playground.com/#U64HVU#7 And another using switch, more controlable / easier to set specific colours at different heights. ( 0-10 ) in this example, http://www.babylonjs-playground.com/#U64HVU#8 Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 18, 2018 Author Share Posted July 18, 2018 6 minutes ago, aWeirdo said: Here's one way; http://www.babylonjs-playground.com/#U64HVU#7 Wow thats really good, thank aWeirdo, thats exactly what I was try do do but I couldn't figure it out.. Thanks! Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted July 18, 2018 Share Posted July 18, 2018 @DylanD You're welcome, i hope it helps , note i added a second version aswell; 12 minutes ago, aWeirdo said: And another using switch, more controlable / easier to set specific colours at different heights. ( 0-10 ) in this example, http://www.babylonjs-playground.com/#U64HVU#8 well, tbf, i should add it will probs never hit 10, but 0-9 . Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 18, 2018 Author Share Posted July 18, 2018 3 minutes ago, aWeirdo said: @DylanD You're welcome, i hope it helps , note i added a second version aswell; Wow yea the second one is even better. Thanks again! Almost a perfect rainbow. All the main colors, rgb xD Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 19, 2018 Author Share Posted July 19, 2018 Hey, @aWeirdo I have another question about your work, I was wondering if you knew how I could make the height keep moving with the emitter box. Like in this playground that way I don't get the white splotches. http://www.babylonjs-playground.com/#U64HVU#9 Any ideas? Quote Link to comment Share on other sites More sharing options...
aWeirdo Posted July 19, 2018 Share Posted July 19, 2018 Hi again, @DylanD Like this ? http://www.babylonjs-playground.com/#U64HVU#10 Just add the position.y of the emitter to the min & max emitBox when calculating Quote Link to comment Share on other sites More sharing options...
DylanD Posted July 19, 2018 Author Share Posted July 19, 2018 14 minutes ago, aWeirdo said: Hi again, @DylanD Like this ? http://www.babylonjs-playground.com/#U64HVU#10 Just add the position.y of the emitter to the min & max emitBox when calculating exactly like that, I wasn't able to get that through my experiments. So, thank you very much! Here is one of my experiments that turned out really cool but not what I wanted. http://www.babylonjs-playground.com/#U64HVU#11 funny I broke down and 30 minutes ago just started doing it with many particle systems instead of just one and math.. time to switch back 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.