cesium 拾取模型表面的坐标

scene = viewer.scene;
var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(function(evt) {
var scene = viewer.scene;
if (scene.mode !== Cesium.SceneMode.MORPHING) {
var pickedObject = scene.pick(evt.position);
if (scene.pickPositionSupported && Cesium.defined(pickedObject)) {
var cartesian = viewer.scene.pickPosition(evt.position);
if (Cesium.defined(cartesian)) {
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
var lng = Cesium.Math.toDegrees(cartographic.longitude);
var lat = Cesium.Math.toDegrees(cartographic.latitude);
var height = cartographic.height;//模型高度
mapPosition={x:lng,y:lat,z:height};
console.log(mapPosition);
}
}
}
}, Cesium.ScreenSpaceEventType.LEFT_CLICK);
上一篇:mysql 插入中文报错: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value...


下一篇:linux screen 命令 :离线运行程序