0 like 0 dislike
60 views

Hi! 

I'd like to play through a fire sprite sheet on an infinite ribbon, spanning across several particles, but it stays on sprite 0 no matter what I set the TextureID to in the evolver script. 

Here's a gif of what I'm doing: http://gph.is/2yEaivf

Do you know where the hole in my code is or if this is possible? Thank you!

On the spawner script:
Life = infinity;
StartDate = scene.Time;
sLR = spawner.LifeRatio;

On the evolver script:
float newAge = scene.Time - StartDate;
TextureID = newAge % 31;


On the ribbon renderer:
TextureIDField = TextureID;
TextureUField = sLR;

 

asked by gtapperdesign (1k points)

1 Answer

1 like 0 dislike
Hi Greg,

Since you asked for an inifity life for your particles, i presume you might have done the same thing with the spawner ?
If you did so, your spawner.LifeRatio is likely to stay at 0. Try using spawner.Age and tweaking it to get the result you'd like to have.

Let me know if this helps you.

Bests,
answered by Maxime (5.4k points)
Nope. The root spawner is set to 0 duration, total 4 particles - with an infinite lifetime.

I'm using spawner.LifeRatio for the TextureUField, but it's acting like spawner.EmittedCount/spawner.SpawnCount.

I get the same result if I use this instead:
sLR = remap(spawner.EmittedCount,0,spawner.SpawnCount-1,0,1);
Oh! Yes, indded, the problem here is that you save spawner.LifeRatio in the spawner script, here your textureID will always be at 0, and will never changes.

I made a little Fx here to reproduce your needs. What you can do in the spawner script:
TextureUField = spawner.EmittedCount / (spawner.SpawnCount - 1);
No changes are needed in the evovler script.

It does the job here, i got a 4 particles ribbon, with an animated texture streched (clamped) on the all ribbon.
...