Ease in transform.LookAt() - keep other target within camera boundaries

Suppose you let the user click on any point in a "grid plane" to look at (`transform.LookAt(Input.mousePosition)`). But, you want to keep a target object within view of the camera.

How would you check that the new lookat view keeps that target object within bounds of the camera? Also, is there a way to ease in the transform.lookat? Would using Lerp be appropriate, or should a curve be used?

To "ease" the rotation, you can Lerp between your (transform.forward * Vector3.Distance(transform.position,target.transform.position)) and your target.transform.position [so you have equal length vectors... you could also normalize]. Then set transform.LookAt() to the resultant vector.

You can use Renderer.isVisible to find out if the camera can see the object, but you'd be better off just setting a position that the camera zooms to that will keep both in view (requires a little math, but you can figure out the angle needed to make the camera equidistance from both target and point).