Cesium模型编辑
实现效果
关键代码
let mx = Cesium.Matrix3.fromRotationX(
Cesium.Math.toRadians(this.opts.rx)
);
let my = Cesium.Matrix3.fromRotationY(
Cesium.Math.toRadians(this.opts.ry)
);
let mz = Cesium.Matrix3.fromRotationZ(
Cesium.Math.toRadians(this.opts.rz)
);
let rotationX = Cesium.Matrix4.fromRotationTranslation(mx);
let rotationY = Cesium.Matrix4.fromRotationTranslation(my);
let rotationZ = Cesium.Matrix4.fromRotationTranslation(mz);
//平移 修改经纬度
let position = Cesium.Cartesian3.fromDegrees(
this.opts.longitude,
this.opts.latitude,
this.opts.height
);
let m = Cesium.Transforms.eastNorthUpToFixedFrame(position);
Cesium.Matrix4.multiply(m, rotationX, m);
Cesium.Matrix4.multiply(m, rotationY, m);
Cesium.Matrix4.multiply(m, rotationZ, m);
let scale = Cesium.Matrix4.fromUniformScale(this.opts.scale);
Cesium.Matrix4.multiply(m, scale, m);
//赋值给tilesetet
this.tileset._root.transform = m;
详情参见 Cesium实战项目