How to randomize life on 2D Particle Effect?

Anything libgdx related goes here!

How to randomize life on 2D Particle Effect?

Postby Jamez0r » Thu Sep 06, 2018 5:54 pm

I'm using the Particle Editor to create a particle effect.

I want to create a burst effect, where the lifetime of each particle is between 200ms and 1000ms.

I only want the burst to happen once.

With pretty much every other attribute (velocity, angle, etc), I can set the range in the "high" category to what I want, and keep the timeline constant at 100%.

For lifetime, instead of each particle having a random lifetime, it seems to pick a single lifetime from the range, and apply it to ALL of the particles being emitted for that "duration". Here is a gif of it: https://imgur.com/LykWMno

From the Particle Effect information page: https://github.com/libgdx/libgdx/wiki/2 ... cle-Editor

Number / number range
Some of the number fields have a > button beside them. Clicking this button changes the number into a number range, where at runtime, a random value is selected from between the two specified values, every time the number is referenced. For example, if a range of 1-2 is selected for the Life property, each new particle will have some random length life between 1 and 2 seconds.
Jamez0r
 
Posts: 245
Joined: Sat Feb 09, 2013 8:46 pm

Re: How to randomize life on 2D Particle Effect?

Postby evilentity » Thu Sep 06, 2018 10:24 pm

You can duplicate the effect a bunch of times, so you will get different times in each one.
Looking for a freelancer? PM me!
evilentity
 
Posts: 4427
Joined: Wed Aug 24, 2011 11:37 am

Re: How to randomize life on 2D Particle Effect?

Postby Jamez0r » Thu Sep 06, 2018 10:29 pm

evilentity wrote:You can duplicate the effect a bunch of times, so you will get different times in each one.


That'd work, just wanted to make sure I wasn't missing something.

Thanks Evil!
Jamez0r
 
Posts: 245
Joined: Sat Feb 09, 2013 8:46 pm

Re: How to randomize life on 2D Particle Effect?

Postby obigu » Fri Sep 07, 2018 11:49 pm

That feature is missing on 1.9.8 but has been added to 1.9.9-SNAPSHOT. There is a new checkbox for Both Life and Life Offset called "Independent" that will apply the Range to each particle individually.

From the wiki
Finally, the "Independent" checkbox. Some properties allow switching how the chart controls the property over time from emitter to single/independent particle. Let's imagine that we have a chart with ranged values defined on the "Life" property. By default the chart affects the emitter as a whole. Each time the emitter generates particles, a random value within the appropriate range for that time will be chosen and all emited particles will have that value set as life. On the other hand, if "Independent" is checked, a new random value will be calculated per emitted particle and set as life to each of them independently.
obigu
 
Posts: 90
Joined: Fri Aug 02, 2013 4:47 pm

Re: How to randomize life on 2D Particle Effect?

Postby Jamez0r » Sun Sep 16, 2018 4:21 pm

obigu wrote:That feature is missing on 1.9.8 but has been added to 1.9.9-SNAPSHOT. There is a new checkbox for Both Life and Life Offset called "Independent" that will apply the Range to each particle individually.

From the wiki
Finally, the "Independent" checkbox. Some properties allow switching how the chart controls the property over time from emitter to single/independent particle. Let's imagine that we have a chart with ranged values defined on the "Life" property. By default the chart affects the emitter as a whole. Each time the emitter generates particles, a random value within the appropriate range for that time will be chosen and all emited particles will have that value set as life. On the other hand, if "Independent" is checked, a new random value will be calculated per emitted particle and set as life to each of them independently.


Thank you!
Jamez0r
 
Posts: 245
Joined: Sat Feb 09, 2013 8:46 pm


Return to Libgdx

Who is online

Users browsing this forum: Google [Bot] and 1 guest