Reputation: 143
I am using the JS forge viewer.
I am trying to select a asset in a building and then zoom in on it with the camera inside the room where the asset is. I am trying to use
let boundingBox = this.viewer.utilities.getBoundingBox(false);
this.viewer.navigation.fitBounds(false, boundingBox, true);
But this will zoom in but not the right direction (from outside to be precise)
Is it possible to automaticly detect the front of a asset, rotate the camera to this and then zoom in?
Upvotes: 0
Views: 569
Reputation: 7070
Apologizing for a long waiting. It has been confirmed by the dev team, Revit room won't be translated in the translation procedure of the Model Derivative service. Therefore, room related functions or APIs will not supported by the Forge Viewer currently.
Besides, we found your API request, zoom in on a asset inside a room, would only appropriate for the BIM app developed with the Forge tech., and there might be many different kinds of use case based on this request. So, it's hard to design a general function or API for your request in the Forge Viewer. Therefore, it might be not supported in the future releases of the Forge Viewer.
However, we encourage developers like you to implement this feature by yourself, and here is a workaround for you:
THREE.Geometry
. [Here is a example to access mesh info. of the Forge Viewer (link)].BoundingSphere
of the THREE.Geometry
from the step. 2
, and treat the sphere center as the central point of the selected asset.Three.js raytracing
with room geometries from the BoundingSphere
center to find some rays without any obstruction between the camera and the selected asset. [Here is a example that shows how to use Three.js raytracing with the Forge Viewer (link)].step. 4
as the sight lines.step. 5
to re-calculate position, target and pivot of the camera.P.S. Since this is just a workaround, not the formal solution. You would have to use it on your own risk.
Upvotes: 1