问题
I have a bounding box object as below:
bb = {
"min": {
"x": -6.637446403503418,
"y": -19.579801559448242,
"z": -0.22575747966766357
},
"max": {
"x": 10.237555503845215,
"y": 19.15947914123535,
"z": 9.774243354797363
}
}
I want to zoom to this bounding box and make camera as centre.
回答1:
You can simply call viewer.navigation.fitBounds( immediate, bounds )
to do this.
- The first argument,
immediate
, means that camera position will animate to the new location if immediate is set as false. - The second argument,
bounds
, stands for the bounding box to fit.
Remember to convert your bounding box to THREE.Box3 object
.
You can refer here for the API document: https://developer.autodesk.com/en/docs/viewer/v2/reference/javascript/navigation/
来源:https://stackoverflow.com/questions/45282331/autodesk-forge-viewer-zooming-to-bounding-box