I have a scene where there are two cameras.
The camera in question is culled to show a background scenery layer that I want to move very slow based on the percentage of level completed by the player, which is on another camera that moves at a different speed.
We have already variable:
I need to move the camera 10% of the background scene sprites width for every 10% of the level complete. What would this calculation look like?
You’d do this by setting the position, something like this
transform.localPosition = new Vector3(completeFactor * backgroundWidth, 0f, 0f);
This is assuming you are moving from 0,0,0 and to the right, and the completeFactor is a value between 0…1 (if you have it in percent, divide by 100).
If you don’t want to move from 0,0,0, use a parent object and have the camera as a child. Make sure the camera is on 0,0,0 and move the parent to accommodate.
1 Like
This is what I sort of envisioned. I have a buddy tell me he read to get the parallax look you should make large background images and tile them, then slowly scroll the scenery image as player moves. This seems like more work than slowly moving a ortho graphic camera over a smaller image. Any thoughts? I have layers, sky doesn’t move, then scenery should move as described above, then player and ground on another camera that follows player with a slight damp.
Either way should be ok, but I would think having just a single camera and moving the background would be less of a hassle, and this way it’s also easier to see and tweak while in the editor.