- 博客(0)
- 资源 (1)
- 收藏
- 关注
Cesium相机进入地下问题,修改ScreenSpaceCameraController源码
想赚波分,所以拿出来分享了,真实有效,不坑人。替换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);
}
2018-08-23
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人