0

I am looking to initially position my Scene's Camera Z-Distance away from a Group in order to make it so that the bounds of this Group will fit into the scene and be as big as possible. The group consisting of a flat plane with some boxes extending towards the camera (think of a bookshelf where the back of the bookshelf is Z=0). The Group and Scene will be varying widths and heights i.e., initial size of bookshelf 100w,50h, scene 1000w 400h.

I initially thought that I could attempt to find the distance using tan(FoV) = sceneHeight / distance; but that didn't work at all. I have looked at a few examples that approach it that way as well, but to no avail have I got this working. I am wondering if I would have to work with the object's initial height i.e., 300, and compare it to the height I am looking for i.e., 1920.

Any help is appreciated, thank you.

MXBuster
  • 43
  • 7
  • You may get some ideas from these related [examples](https://stackoverflow.com/q/37075261/230513) that dolly the camera along _Z_ as a function of `SIZE`, which also serves as a common dimension in the scene. – trashgod Jun 12 '19 at 10:34
  • @trashgod thank you for the link. I don't think that the examples fit what I am looking for, is there one I should look at, I tried the last one. I am trying to have an object be fullscreen when my program open, while the object and the scene will have different widths and heights. Thank you for your help thus far. – MXBuster Jun 12 '19 at 22:27
  • Each example has a `setOnScroll()` handler that might let you determine a suitable _Z_ value empirically, maybe twice the larger object dimension; zoom (scroll) to see the effect off near and far clipping; in any case, give the user intuitive mouse controls, nearby FX controls, and easy access to help. – trashgod Jun 13 '19 at 16:28

0 Answers0