教程示例网站:https://thomaz529.github.io/
一、原理
关闭默认屏幕控制机制,开启ScreenSpaceEventHandler自定义键盘事件,viewer.clock.onTick.addEventListener监听键盘事件,并控制相机的前进后退的操作。
w键是前进,s键是后退,a键是向左,d键是向右,q键是抬起,e键是降低。
二、效果图
三、代码
const scene = viewer.scene;
const canvas = viewer.canvas;
canvas.setAttribute("tabindex", "0");
canvas.focus();
};
const ellipsoid = scene.globe.ellipsoid;
// 关闭默认屏幕控制机制
scene.screenSpaceCameraController.enableRotate
标签:教程,const,ellipsoid,viewer,scene,键控,canvas,Cesium
From: https://blog.csdn.net/weixin_43976807/article/details/144005629