【问题标题】:How to get position of custom model scene builder?如何获取自定义模型场景构建器的位置?
【发布时间】:2021-12-03 08:01:31
【问题描述】:

我用以下设置制作了一些新模型:

  this.cubeSetup = {
  id: "AB0014",
  position: [4, -5, 2],
  rotation: [0, 135, 0],
};


 this.cube1.matrix = new THREE.Matrix4().compose(
  new THREE.Vector3(position[0], position[1], position[2]),
  new THREE.Quaternion(0, rotation[1], 0, 1),
  new THREE.Vector3(1, 1, 1)
);

我会点击它并再次显示信息。我尝试使用 getPlacementTransform().decompose 但结果在坐标 x: 0, y: 0, z: 0 中。

第二个问题,我使用 Autodesk.gltf 加载了一个人体模型。是否可以替换模型的dbId?我想使用 API id,当点击模型时会显示它的信息。我试过了,还是不行。

【问题讨论】:

    标签: autodesk-forge autodesk-viewer


    【解决方案1】:

    您似乎正在设置模型内部的单个元素 (cube1) 的矩阵。使用SceneBuilder 扩展生成的模型保留了自己的矩阵变换,您可以分别使用getPlacementTransformsetPlacementTransform 方法读取和设置。因此,如果您需要给模型本身一个特定的位置和方向,请将转换设置为模型本身,而不是cube1

    【讨论】:

    • 我明白了。谢谢!。当我使用AGGREGATE_SELECTION_CHANGED_EVENT 时,我可以获得属性 THREE.JS 模型吗?
    • 是的,此事件返回一个“选择”列表,其中每个“选择”包含一个 model 及其被选中的 dbIDs 列表。
    猜你喜欢
    • 2015-07-04
    • 1970-01-01
    • 2016-04-30
    • 1970-01-01
    • 2021-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-19
    相关资源
    最近更新 更多