Scrolling a texture - should it streak ?

Hiya guys,

I wondered if any of you have ever used something like this to scroll a texture on a plane?

renderer.material.mainTextureOffset = Vector2(0,-offset);

I am using this command as a cheap way to make my road appear to be moving in my top down iPhone racing game.

I instantiate a new road every game, however the longer I test my game the more the texture becomes slowly streaked. Eventually after a few minutes its noticably streaky.

Can any one suggest a better way to achieve this effect please? Am I using the command incorrectly?

Any thoughts would be very welcome,

Thanks…

Over time the UV offset will become imprecise on the iPhone and the texture will degrade. Instead of constantly increasing the offset have it cycle through the 0-1 range.

renderer.material.mainTextureOffset = Vector2(0,-offset%1.0);

Thanks so much - I shall try that immediately and let you know how I get on.

Beware - negative left-hand argument to modulus operator will result in negative remainders, which is somewhat counter-intuitive:

Yeah that worked fine thanks - no more streaking :slight_smile: