Getting Size and Position of a Model


(Da Be Je Sp) #1

I am trying to change how far the camera zooms in on an object based on the dimensions and position of a model. Is there any functionality that allows me to extract those values from sketchfab? Console outputs give the Bound center, Bbox min, and Bbox max. I am wondering if there is a way I can use these values to adjust the view of the camera.


Viewer API - Accessing Bound Center and Bounding Box values
Getting Size and Position of a Model from Console Values
(Mark Blumreiter) #2

You can use the getCameraLookAt() function from the Viewer API to grab the camera position and target. If you calculate the difference between the positions you'll get how "zoomed in" the camera is on the object. Hope that helps!