Dynamically adjust camera height when switching 2D to 3D


Im trying to adjust the camera height dynamically when switching to 2D to 3D. When switching to 3D there’s terrain or elavation height to the pointcloud. So if the current camera height used in 2D is good but when 3D it’s zoom’s in since the terrain or elevation height added to the pointcloud. So there’s a way to adjust the camera height when the terrain or elevation are added in 3D mode?