构建四元数
// 地理位置坐标(三维)
const position = Cesium.Cartesian3.fromDegrees(
-123.0744619,
44.0503706,
height
);
const heading = Cesium.Math.toRadians(135); // 航向
const pitch = 0; // 俯仰
const roll = 0; // 横滚角
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
/**
Transforms: 将位置转换为各种参考系的函数
headingPitchRollQuaternion - 四元数
根据参考系计算四元数 =》 h: 航向 p: 俯仰 r: 横滚角
**/
// 构建四元数
cosnt orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
hpr,
)
通过entity添加3D模型
const entity = viewer.entities.add({
name: url,
position: position,
orientation: orientation,
model: {
uri: url,
minimumPixelSize: 128,
maximumScale: 20000,
}
});
viewer.trackedEntity = entity;
Cesium的knockout
标签:知识点,常用,const,orientation,entity,四元,Cesium,position From: https://www.cnblogs.com/openmind-ink/p/18008344