【问题标题】:adding localRotation moves ArCore Node?添加 localRotation 移动 ArCore 节点?
【发布时间】:2023-03-25 02:16:01
【问题描述】:

这让我完全困惑。我把这个节点放在场景中,但只要我添加“localRotation”,节点就会移动。如果我不移动它看起来很好(位于我期望的中心位置)。我是否必须初始化四元数以使其垂直于地板平面/姿势?

   scene?.apply {
       boundingBoxNode?.let { scene.removeChild(it) }
       boundingBoxNode = null

       viewModel.boundingBox?.let { box ->
                        MaterialFactory.makeTransparentWithColor(this@MyActivity, boundingBoxColor)
                         .thenAccept { material ->
                              boundingBoxNode = Node().apply {
                                renderable = ShapeFactory.makeCube(box.size, box.center, material).apply {
                                    collisionShape = null
                                    isShadowCaster = false
                                }
                                localRotation = box.rotation
                                scene.addChild(this)
                        }
       }
  }

【问题讨论】:

    标签: android arcore sceneview


    【解决方案1】:

    仅供参考,不要在 ShapeFactory.makeCube(box.size, box.center) 上设置中心。改为执行此操作 (ShapeFactory.makeCube(box.size, Vector3.zero()) 以使其以原点为中心。 然后你可以这样做: worldPosition = box.center 移动它。 我正在旋转一个未居中的盒子:facepalm:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-05-22
      • 1970-01-01
      相关资源
      最近更新 更多