cesium 设置和移动camera相机(工具篇)

如题所述

第1个回答  2022-07-21
1,相机的移动 使用move方法可以朝一个方向移动特定的距离,单位为米。相机移动时位置会发生变化,相机的朝向不变

移动方法:Camera.prototype.move = function (direction, amount)

相机向前移动:moveForward(amount) amount步长:米

相机向后移动:moveBackward(amount) amount步长:米

相机向上移动:moveUp(amount) amount步长:米

相机向下移动:moveDown(amount) amount步长:米

相机向左移动:moveLeft(amount) amount步长:米

相机向右移动:moveRight(amount) amount步长:米

2,相机在固定位置的旋转

方法:Camera.prototype.look = function (axis, angle) 实现原理是给定一个旋转轴和角度,用于四元数计算,然后根据四元数求得旋转矩阵,再根据旋转矩阵更新direction,up,right方向

相机向左看:.lookLeft(amount) amount弧度

相机向右看:.lookRight(amount) amount弧度

相机向上看:.lookUp(amount) amount弧度

相机向下看:.lookDown(amount) amount弧度

朝前方向逆时针旋转相机:.twistLeft(amount) amount弧度

朝前方向顺时针旋转相机:.twisRight(amount) amount弧度