//offsetopt.x,y不能多次更改
updateMatrix: function (offsetopt) {
/*此函数用于计算,同一个模型的偏移前后位置的偏移量。
* 并转换成Matrix4,保存到模型的modelMatrix属性下。
* 其中,offsetopt类似这样:"offset": {
"x": 117.75327858104695,
"y": 39.12059826155268,
"z": -11
},
*/
if (this.model == null) return;
console.log(" 模型修改后位置:" + JSON.stringify(offsetopt));
/*模型修改后位置:{"x":117.75327858104696,"y":39.12059826155268,"z":-11,"heading":0}*/
var boundingSphere = this.model.boundingSphere;
var catographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
var surface = Cesium.Cartesian3.fromRadians(catographic.longitude, catographic.latitude, 0.0);
var offset = Cesium.Cartesian3.fromDegrees(offsetopt.x, offsetopt.y, offsetopt.z);
var translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
this.model.modelMatrix = Cesium.Matrix4.fromTranslation(transla
cesium 模型偏移-定位节点2
于 2019-04-08 18:14:34 首次发布