1

我在波士顿有一套 Cesium 3D 瓷砖建筑。这是一个示例图块:model.glb。当我使用 THREE.GLTFLoader 将此图块导入 Three.js 时,模型相对于 XZ 平面旋转。通过反复试验,我发现我可以通过如下旋转模型来拉直模型:

model.rotation.x = -Math.PI / 4;
model.rotation.z = Math.PI / 10;

我怀疑这种旋转是由于 Cesiuim 默认使用地球固定框架轴 (ITRF)。如何在 Three.js 中自动反转这种旋转(而不是通过反复试验手动进行)?

这是我手动旋转模型之前的模型截图:

手动旋转前的模型

这是我手动旋转模型后的屏幕截图:

手动旋转后的模型

以下是与 Cesium 3D 瓦片相关的地理空间信息:

{
  "boundingVolume":{"sphere":[1525116.05769,-4463608.36127,4278734.88048,28.30055]},
  "geometricError":0.09375,
  "content":{"url":"L12_0000110010123.b3dm"}
}
4

2 回答 2

1

这是我最终做的事情:

// Get the tile's cartesian center.
var cartesian = new Cesium.Cartesian3(1525116.05769, -4463608.36127, 4278734.88048);

// Get the tile's cartographic center.
var cartographic = Cesium.Cartographic.fromCartesian(cartesian);

// Rotate the model.
model.rotation.x = -cartographic.latitude;
model.rotation.z = cartographic.longitude + Math.PI / 2;
于 2018-06-19T17:07:33.477 回答
0

只需将“gltfUpAxis”转换为“Z”就可以了。或者你也可以试试“Y”。

"asset": {
    "gltfUpAxis": "Z",
    "version": "1.0"
  },
于 2019-03-06T08:05:21.513 回答