Trying to recreate the doodlejump camera c#

So i’ve been trying to recreate the doodlejump camera in unity. In short, the if the player goes above a virtual line, the camera starts to follow the player and goes up. If the player is under the line, the camera doesn’t move. To get a better idea of what i’m trying to achieve, doodlejump is free to download.

Thanks :slight_smile:

Ok so I’m not sure if this is exactly what you want, but try putting this script on your main camera:

	public GameObject player; 

	Vector3 cameraHeight; 

	// Use this for initialization
	void Start () {
		cameraHeight = transform.position; 
	}
	
	// Update is called once per frame
	void Update () {
		if(player.transform.position.y >= 3)
		{
			cameraHeight.y = player.transform.position.y - 3; 
			this.transform.position = cameraHeight; 
		}
	}

Assign the ‘player’ variable to your player by clicking on the main camera in the hierarchy, then dragging your character gameobject into the slot in the inspector. Also, if you wish to change the height of the “invisible line”, then change the value of the 3’s in Update(). Hope I helped, and if this wasn’t what you wanted, then feel free to ask another question and I’ll see if I can fix it.