Cesium相机进入地下问题,修改ScreenSpaceCameraController源码

时间:2021-09-12 08:33:04
【文件属性】:
文件名称:Cesium相机进入地下问题,修改ScreenSpaceCameraController源码
文件大小:94KB
文件格式:JS
更新时间:2021-09-12 08:33:04
Cesium 相机 地下问题 想赚波分,所以拿出来分享了,真实有效,不坑人。替换scene下的ScreenSpaceCameraController代码,用cesium.js自己打开文件,找到这部分替换,另外上传不能修改,其中pickGlobe函数用下面替换 function pickGlobe(controller, mousePosition, result) { var scene = controller._scene; var globe = controller._globe; var camera = scene.camera; if (!defined(globe)) { return undefined; } var depthIntersection; if (scene.pickPositionSupported) { depthIntersection = scene.pickPositionWorldCoordinates(mousePosition, scratchDepthIntersection); } var ray = camera.getPickRay(mousePosition, pickGlobeScratchRay); var rayIntersection = globe.pick(ray, scene, scratchRayIntersection); var pickDistance = defined(depthIntersection) ? Cartesian3.distance(depthIntersection, camera.positionWC) : Number.POSITIVE_INFINITY; var rayDistance = defined(rayIntersection) ? Cartesian3.distance(rayIntersection, camera.positionWC) : Number.POSITIVE_INFINITY; if (pickDistance < rayDistance) { return Cartesian3.clone(depthIntersection, result); } return Cartesian3.clone(rayIntersection, result); }

网友评论

  • 存在问题,基本没用
  • 当聚焦某个实体时,鼠标左键旋转还是会进入地下
  • 还是有bug,需要再次修改
  • 请问是您该的是哪个版本的Cesium呢?谢谢!