Jump to content

Particle System Colour changing


DylanD
 Share

Recommended Posts

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?

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

@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 ;) .

Link to comment
Share on other sites

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 :) 

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