1. 首页
  2. 编程语言
  3. Javascript
  4. Cesium相机进入地下问题,修改ScreenSpaceCameraController源码

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

上传者: 2018-12-08 07:47:43上传 JS文件 93.7KB 热度 47次
想赚波分,所以拿出来分享了,真实有效,不坑人。替换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, scratchDepthIntersec tion); } 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); }
用户评论
码姐姐匿名网友 2018-12-08 07:47:43

当聚焦某个实体时,鼠标左键旋转还是会进入地下

码姐姐匿名网友 2018-12-08 07:47:43

还是有bug,需要再次修改

码姐姐匿名网友 2018-12-08 07:47:43

请问是您该的是哪个版本的Cesium呢?谢谢!