A camera that determines whether an object fits on the screen.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By VLAHIN

Hello.
I have objects randomly generated, and I need the camera to automatically determine whether the object fits on the screen and automatically move the camera away or approach. But I can not find a suitable node or tell me an approximate algorithm. Objects cannot be guessed in advance because the size is also random.
I have a procedure that puts the camera at predefined coordinates, but it’s impossible to predict everything correctly.

:bust_in_silhouette: Reply From: RuKeN

Have you tried with the Clipped Camera node?
https://docs.godotengine.org/en/stable/classes/class_clippedcamera.html

The Clipped Camera is able to have a collider or area to prevent colíder with other objects