Camera jumps to another object with mouseclick,How to 'jump' to another moving game object (e.g planet)

I’m currently developing a solar system simulator and I’m trying to find a solution to movement between the planets - say if my main camera was in the orbit position of an object, and I want to move to another object in the system by clicking on it. To my basic knowledge it requires raycasting. ,I am currently developing a solar system model, and I’m currently looking for a way to click on another planet so my camera view changes from the object I’m planet I’m focused on to the other planet. From my basic understanding I’m aware that this requires raycasts.

How I would do :

  1. One script that manages the input and raycast from camera to pointer direction to check if the raycasts hits a planet collider, and stores the planet in a public variable.

  2. A script attached to your camera which, on its FixedUpdate, follows the desired planet (the one stored in your public variable) with an offset, and looking at the planet.

They are quite a lot of tutorials on Youtube regarding how to do both things!