I’m new to three js. I want implement a functionality like when we draw a rectangle in the screen the scene should get zoomed to that rectangle. Like “window-zoom” in other 3D applications. Could someone help me out of it? Is there any in-built option available to achieve this?
Thanks for your response. I actually saw this thread, but here it using objects to calculate the boundingbox. In my case, the window can be drawn any part of the window. Even there is no objects, that part should get zoomed.
Ah I see what you mean now you want a sort of “zoom box” behaviour? Is this SO question similar to what you’re after? It’s incomplete but you can get a rough idea of how the basics of this would work playing with the following pen…
this is a better orbit control, it can replace it entirely and it has that functionality inbuild. look for fitToBox.
the problem with these approaches above, in my experience, is that they’re often (always?) half cooked. i tried all of them and they work in a theoretical manner but failed in the real world. if you have a control they fail because they can’t interface with it (which imo they must). if you have a different camera they fail (orthographic, most are primed for perspective). or they can’t animate, and if they do they highjack movement. cc seems to have solved all of these issues.
I don’t know, at a random pick I chose to search for BufferGeometryUtils which yesseems to be… If there’s a script to do it I wonder why it’s not being used (emphasising my point) on the libs as in question…?
the problem with “seem to be” is it’s worse than “obviously arent” - people assume they are and do not scroll down when the stuff is out of order, missing out on the knowledge that is hidden down there but since 3js docs are fully manual thing, somebody has to sit down and fix them. and even then it costs nothing for somebody else to ruin it again.
I’m not sure I follow your train of thought, I guess it’s quite a task to update such a comprehensive documentation ( on many pages, by hand) in terms of three but doing so with a lib / extension with not nearly as many examples and extensive documentation should be a breeze (especially with a script to do so) right? Anyway not to let this go off topic