Camera Controller to Player Position Conflict

I don’t know whether I’m being thick here but I’m going to try and explain it.

The MainCamera is attached to a parent object called CameraController.
CamerController follows player simply with;

			parent.transform.position = target.transform.position;

However, when the player teleports to a new location I would like a nice pan which means delaying(?) this follow. Am I along on the right lines.

So I put this line on, I’ve also tried SmoothDamp;

		Vector3.Lerp(parent.transform.position, target.transform.position, Time.deltaTime * 1); 

This line does not work how we would like it to.

So with directly changing the transform we get this, as you can see cameraController object is on and follows the player. Great.

Using the Vector3 method we get this. CameraController doesn’t move towards the player at all.

I’ve set the script up so when the player is teleporting, it switches methods.

if (delayOn == true) 
			Debug.Log ("lets damp it");
			//Vector3.SmoothDamp(parent.transform.position, target.transform.position, ref velocity, smoothDamp); 
			Vector3.Lerp(parent.transform.position, target.transform.position, Time.deltaTime * 1); 

		else if (delayOn == false)
			parent.transform.position = target.transform.position;
			//Vector3.MoveTowards(parent.transform.position, target.transform.position, Time.deltaTime * 5); 


The actual camera changes perspectives which are set up as camera targets around the player.

Any ideas or possible solutions would be greatly appreciated.
Thanks :slight_smile:

EDIT: I think all I’m trying to do is find a way to temporally delay this line of code.

	parent.transform.position = target.transform.position;

I was being thick.

parent.transform.position = Vector3.MoveTowards(parent.transform.position, target.transform.position, Time.deltaTime * 0.9f);