Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
Help with SetTextureOffset?
Post Body

Hey guys,

Brief preface: I'm a 1st year games design student and therefore have no idea what the fuck I'm doing - we're working on group projects right now and my limited programming knowledge got me promoted to developer as everyone else has even less concept of what the fuck they're doing...

 

So here's my problem. I have a quad with a scrolling texture (infinite runner style), using SetTextureOffset to achieve the effect. When my character collides with an NPC the scroll effect stops. However, as I'm doing the scroll effect like this:

 offset = Time.time * scrollSpeed;
 renderer.material.SetTextureOffset("_MainTex", Vector2(offset,0));

I have a problem. The scroll effect is stopped, but deltatime doesn't stop (naturally), so offset continues to increment, meaning when I restart the scroll effect there's a visual jump as SetTextureOffset catches up with offset's deltatime driven value.

Honestly, I don't know what kind of solution I'm looking for here (braindead from trying a load of different ideas). Any advice? My last-resort option is to just have a carousel of sprites spawning in instead of using a single quad with texture offset.. but I don't wanna do that if it's avoidable 'cause it seems nasty and complicated and I won't have learned anything.

Thanks!

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
50,347
Link Karma
268
Comment Karma
50,061
Profile updated: 2 days ago
Posts updated: 8 months ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
10 years ago