在用cesium开发webgl应用时,相机的角度和位置需要调整来,调整去,很是耗费时间,
下面的方法是快速获取想要角度的方法:

把模型加入到页面后,把相机的参数打印出来,点击F12,调整好角度、位置后,想要的参数也就有了

        // 同步
        function loop() {
			console.log('heading=',cesium.viewer.scene.camera.heading)
			console.log('pitch=',cesium.viewer.scene.camera.pitch)
			console.log('roll=',cesium.viewer.scene.camera.roll)
			console.log('position=',cesium.viewer.scene.camera.position)
            requestAnimationFrame(loop);
            renderCesium();
            // renderThreeObj();
        }

在这里插入图片描述
这个方法是不是很快!

Logo

GitCode 天启AI是一款由 GitCode 团队打造的智能助手,基于先进的LLM(大语言模型)与多智能体 Agent 技术构建,致力于为用户提供高效、智能、多模态的创作与开发支持。它不仅支持自然语言对话,还具备处理文件、生成 PPT、撰写分析报告、开发 Web 应用等多项能力,真正做到“一句话,让 Al帮你完成复杂任务”。

更多推荐