How to : rotate the camera around a planet (earth) when click on a point

hi y’all

I am lost here, trying to do something that i thing is too complicated for my level

I have a lowpoly sphere object (like planet earth)
I have a camera
i created an empty gameobject in the middle of the sphere to act as a pivot, and ask the camera to always lookat the pivot

I want the camera to rotate arond and focus facing the point i just clicked on the sphere (instead of draging the sphere to rotate)

so far i think i have to do the following :

for the cameramanager

  • awake : camera lookat pivot
  • update : camera lookat pivot (so it always facing the center of the sphere?)
    on mouse click
  • get a hit from the raycast where i click
  • get the vector3 going upward perpendicular from the surface of the sphere (??? how do i do that? and my planet object is not smooth it is like a lowpoly earth, so the perpendicular vector3 will not be the one i want…)
  • calculate the angle between my current vector3 from camera position to pivot and the new vector3… and do a rotation of that angle…

or should i move the camera to the point that is flying above the clicked point… how to get that point ?

i think i am completly missing something… sounds to complicated for nothing.

thank you !

i understand i have to use
cam.transform.position = Vector3.SmoothDamp

in order to move the camera

but how to get the point that is directly upward from the clicked point on the irrugular sphere…