private IEnumerator ActivateCameraPrewarmed(Transform target, CinematicCamera previousCamera) { if (Composer != null) { // Lock camera rotation to target before prewarming LookAt damping. transform.LookAt(VirtualCamera.LookAt, CameraUp); } if (Transposer != null) { // Lock position to target before prewarming Follow damping. transform.position = VirtualCamera.Follow.position; } // Enable incoming camera, then wait a few frames before switching to it to let it prewarm. // This hides the camera's readjustment to the target. VirtualCamera.enabled = true; yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); yield return(new WaitForEndOfFrame()); // Switch cameras. previousCamera?.DisableCamera(); VirtualCamera.Priority = 100; yield break; }
public void MakeActiveCamera(Transform target, CinematicCamera previousCamera) { if (!OverrideLookAt) { VirtualCamera.LookAt = target; } if (previousCamera != this) { StartCoroutine(ActivateCameraPrewarmed(target, previousCamera)); } }