根据朝向创建四元数调整模型方向
根据朝向创建四元数调整entity方向 沙盒示例:3D Models
2022-11-27 01:48:32
标签:
const position = Cesium.Cartesian3.fromDegrees(
-123.0744619,
44.0503706,
height
);
const heading = Cesium.Math.toRadians(0);
const pitch = 0;
const roll = 10;
const hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
// 四元数
const orientation = Cesium.Transforms.headingPitchRollQuaternion(
position,
hpr
);
const entity = viewer.entities.add({
name: url,
position: position,
orientation: orientation,// 朝向,可动态变化
model: {
uri: url,
minimumPixelSize: 128,
maximumScale: 20000,
},
});