晨风のblog
首页
栏目分类
默认分类
Cesium
Vue
C#
Linux
Docker
Revit
Neo4j
Cypher
Nginx
归档
关于
归档
关于
首页
Cesium
正文
Cesium 隐藏地球后,相机进入地下后,滚轮缩放视角后,会越来越远
晨风
2023-02-08 PM
195℃
0条
Cesium 隐藏地球后,只显示模型,相机旋转进入地下后,滚轮缩放视角后,相机会里模型越来越远。 解决方案: 修改Cesium源码Scene.js中isCameraUnderground方法 原代码为: ````javascript function isCameraUnderground(scene) { const camera = scene.camera; const mode = scene._mode; const globe = scene.globe; const cameraController = scene._screenSpaceCameraController; const cartographic = camera.positionCartographic; if (!defined(cartographic)) { return false; } if (!cameraController.onMap() && cartographic.height < 0.0) { // The camera can go off the map while in Columbus View. // Make a best guess as to whether it's underground by checking if its height is less than zero. return true; } if ( !defined(globe) || !globe.show || mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING ) { return false; } let globeHeight = scene._globeHeight; return defined(globeHeight) && cartographic.height < globeHeight; } ```` 修改后的代码为: ```javascript function isCameraUnderground(scene) { const camera = scene.camera; const mode = scene._mode; const globe = scene.globe; const cameraController = scene._screenSpaceCameraController; const cartographic = camera.positionCartographic; if (!defined(cartographic)) { return false; } if (!cameraController.onMap() && cartographic.height < 0.0) { // The camera can go off the map while in Columbus View. // Make a best guess as to whether it's underground by checking if its height is less than zero. return true; } if ( !defined(globe) || // !globe.show || mode === SceneMode.SCENE2D || mode === SceneMode.MORPHING ) { return false; } let globeHeight = scene._globeHeight; if (!globe.show) { globeHeight = -0.01; } return defined(globeHeight) && cartographic.height < globeHeight; } ``` 修改后重新打包Cesium,即可
标签: none
非特殊说明,本博所有文章均为博主原创。
如若转载,请注明出处:
http://blog.chenfengly.com/index.php/archives/33/
上一篇
Nginx代理SignalR
下一篇
PVE8.0开启vGPU虚拟化
取消回复
评论啦~
提交评论
栏目分类
默认分类
5
Cesium
5
Vue
1
C#
3
Linux
4
Docker
2
Revit
1
Neo4j
0
Cypher
1
Nginx
1
标签云
cesium
vue
tree
cypher
elementui
node
SqlServer
neo4j
C#