0 like 0 dislike

Expected behaviour: I have a texture atlas with 2 frames, let's call them 0 and 1. I want a ribbon that's stretched along its length, scrolling, but picking a random texture each time, yielding 01001010111101001000110101 or suchlike.

(this is for a smoke I'm designing but 0s and 1s show what I'm dealing with).

Steps performed:

1.)  in the Spawner Script, I've got TextureID = rand(0,2)*

2.) In order to stretch the sprite across the ribbon, I'm adding a "RibbonU" float to my TextureUField. RibbonU is defined in my evolver script thusly:

    RibbonU = LifeRatio *10 - scene.Time* 5;

Experienced Behaviour:Well, it's random?

So am I setting this up incorrectly? I'd like to set the bitmap tiling size and scroll speed through the usual RibbonU controls, but I should STILL be able to select a random image from an atlas every time my ribbon texture tiles, should I not?

Please let me know if I'm barking up the completely wrong tree; between the rand weirdness (see post-script) and this, I've hit a bit of a wall.

Thank you in advance for your time and attention!

* randomness for this is set as (0,2) since (0,1) only returned frame 0? Using (0,2) yielded a good randomness between 0 and 1, but once I update my TextureUField, I get the attached image. Setting rand (0,1) with the TextureUField in place yields a clean stream of 010101, with no randomness happening. So I'm not sure if rand is working the way I expect it and I'm not sure if  RibbonU is working the way I expect it, but I'm relatively new to Popcorn so I might be off-base across the board. <3


This question is a Duplicate of a more recent one I posted, entitled "Why is my texture garbled (on a scrolling ribbon using random sprites from an atlas)?"

Please refer to that question instead; my user profile said I had only asked one question (which has been answered) so I worried that this (my first question) had gotten removed. Then I found it? Anyway, consider this a (poorly phrased) dupe of the more recent question. Thanks in advance! Sorry for the confusion.

asked by SevenCubed (200 points)

1 Answer

0 like 0 dislike
Closing as duplicate
answered by Julien (32.2k points)