Forge Viewer - BimWalk Teleportation

纵然是瞬间 提交于 2021-02-11 16:47:24

问题


I wanted to use teleportation property of BimWalk extension in my own function of forge viewer. But, I was not able to find the implementation details of teleportation. Is there any way for teleporting to specific object of the model in forge viewer?


回答1:


The simplest approach would be to mimic the mouse interaction to trigger teleporting and set the

// when in first person mode
const bimWalk = viewer.getExtension('Autodesk.BimWalk')
bimWalkExt.tool.navigator.teleporting = true
viewer.select(dbid)

Alternatively you can set the destination of teleportation by calling the navigator tool of the BimWalk extension directly, something like:

  const navigator = bimWalkExt.tool.navigator
  const camera = viewer.navigation.getCamera()
  navigator.teleporting = true;
  navigator.teleportTime = 0;
  navigator.teleportInitial.copy(camera.position);

            // Set target position, collision plus camera's height.
            const cameraUp = getTempVector(camera.worldup);
            cameraUp.multiplyScalar(navigator.get('cameraDistanceFromFloor') * this.metersToModel);

            this.teleportTarget.copy(intersection.intersectPoint).add(cameraUp);

            // On floor teleport ends on the spot.
            this.teleportVelocity.set(0,0,0);

As Eason has suggested to you earlier there's no official documentation available so you'd need to look through the code yourself ...



来源:https://stackoverflow.com/questions/61634660/forge-viewer-bimwalk-teleportation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!