I am developing a simple side scrolling game. I want to target and zoom camera on player when he dies. But it rotates the screen, and I want to prevent it. I'm copying the snippet of code here :
IEnumerator ZoomIn()
{
while (GameCamera.orthographicSize > 2) {
yield return new WaitForSeconds (0.01f);
GameCamera.orthographicSize -= 0.2f;
}
}
public void ZoomCamera()
{
CameraZoomSource.Play ();
StartCoroutine (ZoomIn ());
}
public void TargetPlayer()
{
transform.LookAt (PlayerTransform);
GameCamera.orthographicSize = 3;
GameCamera.transform.Rotate (0, 0, -2);
}
Should I change anything in this?