How to make camera focus on moving object and change what object to focus on

Im new to unity and i currently have a bunch of planets(all gameobjects) rotating around a sun(also a gameobject) and im trying to make it so when i click in one of the planets the camera will zoom in on it, and im trying to get it so when i scroll out it will pull the camera away from the planet as well. anyone know how I can do this? also, is it possible to make it so once a planet is selected i can rotate the camera 360 degrees up and down the planet?

EDIT: Forgot to say im using Javascript

You can do this by adjusting the smoothFollow camera script to switch it’s targets on a mouse press and lerp the camera between the current target and the new target… All my code is in C# and has a lot of custom code specific to our game so I wont post it here… Can’t quite remember ( been away from unity for a couple of months ) but I think the smoothfollow script comes with the built in unity script assets…

Thanks :smile: