Aframe中的导入场景将原点重置为0,0,0

问题描述 投票:0回答:1

问题:在Aframe中导入的所有对象的原点都在0,0,0

导出的场景来自混合器,在其中将原点设置为每个多维数据集的中心,请参见右上角的多维数据集。

在Aframe中导入gltf文件后,每个多维数据集的原点都为0,0,0。因此,如果我检查JavaScript中每个多维数据集的位置,它们都是相同的。

GLTF是正确的,当我在搅拌机中再次导入它时,原点仍然在立方体的中心。

Blender file origin of top right cube is in center, even after export to gltf and imported againAframes inspector shows origin of all cubes and selected top right cube is 0,0,0

如果它们都在0,0,0位置,如何获得Aframe中每个立方体的正确坐标?

blender aframe gltf
1个回答
0
投票

这对我有用:

  window.addEventListener("model-loaded", (e) => {
    const sceneObj = document.querySelector("a-scene").object3D;
    let object;
    object = sceneObj.getObjectByProperty("name", "cube1");
    console.log(object.position);
    object = sceneObj.getObjectByProperty("name", "cube2");
    console.log(object.position);
  });
© www.soinside.com 2019 - 2024. All rights reserved.