- Home /
Scrolling Background
Hello again,
I have given up on the idea of editing the camera to get what a require. Why? because it doesn't like me any more, (never really did).
My question is, is there anyway to make the scrolling background effect, like on Terraria, starbound and any other good 2D games, in a orthographic camera mode?
The perspective mode has proven a pain due to the fact, all side are perspective, not just the left and right view sides (My Previous Question for what i mean).
Thank you for your help in advance, Lachee
Answer by Loius · Jan 17, 2013 at 03:34 AM
Yeah.
Build the world in several layers - from closest to camera, to farthest from camera.
Don't move the layer which the player moves on.
If a layer is farther from the camera than the 'player layer', then whenever the camera moves, move the layer by a smaller amount in the same direction.
If the layer is closer to the camera than the player layer, do the same thing, but move the layer in the opposite direction.
Hey, thanks for answering my question again :D, So all i need to do is and a script the contains all the objects, get their position in relevance of 0,0,0 and moving in accordance? i.e. Speed = transform.position.z - 50. So if its further than 50 in z, it will move in a positive manner, and below, it will move negatively.
Found a code, located here: http://answers.unity3d.com/questions/164696/most-efficient-way-to-achieve-2d-parallax-effect-w.html
Your answer
Follow this Question
Related Questions
Making a camera semi-orthographic 2 Answers
The sprite that is being followed by thr camera is very jittery and doesn't look very nice at all. 2 Answers
2D camera panning and can't click UI buttons 0 Answers
How to make the background follow the camera 5 Answers
Change the background color attribute of a camera in C#? 2 Answers