Hopefully, this is a relatively simple one.
On the main screen of my game, I have a camera that is facing a model of the Earth. I want the player to be able to right-click somewhere on the Earth and instantly have the camera re-orient so that it’s focused on that spot. The camera needs to remain the same distance from the planet, and the camera needs to keep the center of the planet in focus.
I have reasons for why I can’t make the planet turn to face the camera.
Is there an easy function for this, or will I have to write it from scratch?
I already know that I can use Transform.LookAt to get the camera to face the right location and can probably figure out how to get the camera to maintain the correct distance, so the only question is how to orient the camera so that it’s facing the exact spot the player right-clicked on.
I also want to add that I know what logical function would make this happen. In this case, a line would be created between the center of the sphere and the surface where it was clicked, then the camera would be positioned along this line at a distance further away from the center of the sphere, and then the camera would be rotated to face the center of the sphere. All of this would happen instantly. The only thing I’m at a loss for is how to specify the vector coordinates of the new location for the camera.
