源码
const origin = this.entity.position.getValue()const heading = Cesium.Math.toRadians(this.rotateX)const pitch = Cesium.Math.toRadians(this.rotateY)const roll = Cesium.Math.toRadians(this.rotateZ)const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll)const orientation = Cesium.Transforms.headingPitchRollQuaternion(origin, hpr)this.entity.orientation = orientation
获取不到position 添加一下时间试试
- pitch是围绕X轴旋转,也叫做俯仰角,
- heading(yaw)是围绕Y轴旋转,也叫偏航角,(平行于z轴,就是水平旋转的,其他同理)
- roll是围绕Z轴旋转,也叫翻滚角,
只让他x轴旋转改动了一下代码
value是传进来的slider数据
this.sliderEntity是实力的实体 Entity
最后设置了实体朝向也就是 orientation