x


Scrolling and Looping 2D Background Image

Alright, I'm a bit of a beginner here with unity, and basically I'm working on a sidescrolling game, and what I'm trying to figure out is how to get a 2D background image to scroll around as the character moves, and loop the end of the image to the beginning of the image when it needs to. I'm just looking for the basics of how to make this work, and then I can modify my scripts to get this to work if I need to.

What I've done to get a 2D background image so far is just creating a 2nd camera to display the image in the background by setting it to have a culling mask for only the background image. I can change my method of displaying the background image to get the image scrolling if need be.

more ▼

asked Oct 09 '11 at 09:58 AM

haln gravatar image

haln
1 1 1 1

use a quad, set texture to wrap mode and animate the uvs, throw in a mod operator to avoid having your uvs stray too far from 0 to 1

Oct 09 '11 at 10:37 AM loopyllama

Turn that into a fleshed-out answer!

Oct 09 '11 at 10:47 AM syclamoth

That's kind of cheating, but displays a basic knowledge of search functions that most people who ask questions on this site lack...

Oct 09 '11 at 11:19 AM syclamoth

Thanks, that's really helpful. I did a quick search before I asked the question but didn't turn up anything useful. Guess I missed something, thanks!

Oct 10 '11 at 06:20 AM haln
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1040
x258
x167
x56
x38

asked: Oct 09 '11 at 09:58 AM

Seen: 4370 times

Last Updated: Oct 10 '11 at 06:20 AM