@Dschoonmaker said:
I don't think the editor actually zooms automatically to fit the object inside the screen, it looks like it stays at whatever zoom level you were at previously. Could you perhaps do the same?
Maybe you could zoom out, then for each corner of the AABB, raycast to the camera, and check if it needs to zoom in. The problem is, I don't know how you could calculate how much you'd need to zoom in.
This also seems like a messy and inefficient method of achieving this goal.
It should do, well it does in my editor? If the object has a visible component, the camera points at the object and zooms in. I'm running 3.2.stable.
@Megalomaniak said:
I wonder if the camera object might have a function for checking that. Haven't looked into it before though.
I guess the interpolated camera might be able to do something about it.
perhaps just creating a vector position to move the camera to might be enough, simply make sure its the distance of the target objects AABB or more away from the target object?
I've had a look through the documentation of the Camera and can't find anything.
Hmmm, this might actually work! The focusable objects won't have extreme ratios in their size, maybe 4:1 at a maximum. I could as you say, take the largest size across all coordinates, then align the camera at a fixed distance from the object based on the extremity and a coefficient based on the ratio of the viewport rect. I know the FOV is fixed to what I assign, so there won't be any variables to contend with.
Unless somebody comes along with a better way of doing it, I will put something simple together and try cranking the window size around like a crazed window resizer and see if I can trip it up.