anthonyec / godot_little_camera_preview

🎥 Picture-in-picture style preview for both 2D and 3D cameras
MIT License
605 stars 8 forks source link

The nearest Camera #13

Open padreputativo opened 5 months ago

padreputativo commented 5 months ago

My game is composed of a bunch of scenes within other scenes (as it should be done in Godot), and my camera is also a scene, so I can never click on it because the main node of the camera scene is not of camera type. It would be interesting for the addon to detect nodes that are scenes and search for cameras wherever you click (optionally) following the node tree inward.

padreputativo commented 5 months ago

Another way to explain it would be that when opening a scene, the addon scans the nodes looking for camera-type nodes and chooses the first one it finds for the preview. If there are multiple cameras, then you can click on the appropriate camera (following the tree if you click on a node that is not a camera type).

anthonyec commented 5 months ago

Good suggestion, makes sense! The thing that has prevented me from adding such a feature is that there needs to be a limit on how deep it searches the tree for cameras. It can potentially get computationally expensive.

But that's something that could be configurable, just need to think of a friendly way to expose that option.

For your scenes, how nested are the camera nodes in the tree? Is it usually one level deep (root of the scene), or a few nodes deep?

padreputativo commented 5 months ago

In my game, the player is an independent scene which in turn has another independent scene that is the camera (each with its own functions), and everything is dynamically added during gameplay. I'll probably add another type of scene in the maps that serves as a camera to focus on a specific "view" (for example, focusing on a control panel in first-person view). This camera-view scene will also have to be its own scene, although in this case I might be able to make the camera the owner node of the scene. Nonetheless, it will still be a separate scene so that it can execute certain actions automatically, adding certain extra functionality to the Camera3D node.