2D Camera Follow help

I am making a 2D side scrolling game, at the moment i have a camera that follows the X and Y coordinates of the player. What i wish to do is have the camera follow a particular path on the y axis, but it only moves along the path given the characters X coordinate, is this possible. is there a way to animate the Y coordinate depending on the X?

Sorry if that i confusing i find it hard to explain.

Play abit of limbo and you’ll see what i mean. The reason i want to do this is because i don’t want jumping to effect the y coordinate of the camera and i don’t want the camera to follow the ground as there will be gaps in the path. :face_with_spiral_eyes::face_with_spiral_eyes::face_with_spiral_eyes::face_with_spiral_eyes:

Anyone?

pleeaassee anyone?

I’ve build something very similar in a past prototype. Actually I was using iTween for that, building it upon the “Path constrained characters” example:
http://itween.pixelplacement.com/examples.php

So basically what I did was to set both the player as well as the camera on two individual paths. The current path percentage was shared though, so basically the player movement also drove the camera’s movement - both constrained to their paths.

Jumping of the player was no problem either as you could make the camera always target the player (as long as you use a look-at-dampening).

There are some more tweaks coming along with that like changing player and/or camera movement paths and such, but the main idea behind that should be clear once you download the example files and have a look at how the stuff is built.

Use a script that sets the camera’s x position to the players.

Something like

Camera.position.x=player.position.x

There’s multiple ways to go tackle this issue, but i think the simplest way would be to create a seperate camera path, and have a script keep the x-component of the camera updated.

Sadly i don’t yet know how to make a camera path myself, and problems could arise where x-coordinates in the path are not unique…
I remember there used to be an asset called ‘camera path’, maybe it could help making this task easier or give you additional ideas on how to achieve what you want.

Just by looking at it’s behaviour i find it hard to take a good guess at the camera mechanics, but it mostly seems to me as the camera has a bounding area of some sort where it’s allowed to be, only moving the camera to the closest allowed position apart from some cases where;
As long as the player is in a certain position the camera will stay in a specific region (nice example would be at the first spider encounter). But that’ as much as i’d dare try guess about it’s mechanics. Not much of the cameras movement seems to be limited in any real way (to me).

Thanks for all the help some really good ideas here!