//PRIVATE METHODS void UpdateAnimation() { if (animationTarget == null) { Debug.LogError("There is no aniamtion target specified in the Camera Path Bezier Animator component. Nothing to animate.\nYou can find this component in the main camera path component."); Stop(); return; } if (!playing) { return; } animationTarget.position = bezier.GetPathPosition(usePercentage); if (isCamera) { animationTarget.GetComponent <Camera>().fov = bezier.GetPathFOV(usePercentage); } Vector3 minusPoint, plusPoint; switch (bezier.mode) { case CameraPathBezier.viewmodes.usercontrolled: animationTarget.rotation = bezier.GetPathRotation(usePercentage); break; case CameraPathBezier.viewmodes.target: animationTarget.LookAt(bezier.target.transform.position); break; case CameraPathBezier.viewmodes.followpath: if (!bezier.loop) { minusPoint = bezier.GetPathPosition(Mathf.Clamp01(usePercentage - 0.05f)); plusPoint = bezier.GetPathPosition(Mathf.Clamp01(usePercentage + 0.05f)); } else { float minus = usePercentage - 0.05f; if (minus < 0) { minus += 1; } float plus = usePercentage + 0.05f; if (plus > 1) { plus += -1; } minusPoint = bezier.GetPathPosition(minus); plusPoint = bezier.GetPathPosition(plus); } animationTarget.LookAt(animationTarget.position + (plusPoint - minusPoint)); animationTarget.eulerAngles += transform.forward * -bezier.GetPathTilt(usePercentage); break; case CameraPathBezier.viewmodes.reverseFollowpath: if (!bezier.loop) { minusPoint = bezier.GetPathPosition(Mathf.Clamp01(usePercentage - 0.05f)); plusPoint = bezier.GetPathPosition(Mathf.Clamp01(usePercentage + 0.05f)); } else { float minus = usePercentage - 0.05f; if (minus < 0) { minus += 1; } float plus = usePercentage + 0.05f; if (plus > 1) { plus += -1; } minusPoint = bezier.GetPathPosition(minus); plusPoint = bezier.GetPathPosition(plus); } animationTarget.LookAt(animationTarget.position + (minusPoint - plusPoint)); break; case CameraPathBezier.viewmodes.mouselook: animationTarget.rotation = GetMouseLook(); break; } }