How can i make the camera zoom in after an event

Hi, everyone

Lets start :slight_smile:

The camera is following the player, now the player has a script that makes him scale down after a certain event. Now when the player is scaled down, he is too small and i can’t see him clearly, so what kind of code i should use so i can make the camera zoom in to have a clear view of the player?

Thank you all for your time, any help is greatly appreciated.

The camera is following the player at a certain distance. When the player shrinks reduce that distance.

For example if the camera is going from Y axis = 2 (which is the current position of the camera) to Y axis = 3


public speed = 0.1F;

Private Vector3 startPoint;

Private Vector3 endPoint = new Vector3 ( any postion, 3, any position);

void Start()


startPoint = transform.position - player.tranform.position;


void Update()


transform.position = Vector3.Lerp(startPosition, endPosition + player.transform.position, Time.deltaTime * speed);


This is the answer but i think to make the appropriate Lerp the time should be adjusted somehow.