Android Arcore Plane Tracker Target

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

我在论坛上找不到任何内容,我想设法在集成在飞机上的arcore上创建一个目标,例如Measure。 (避免图像在版面居中时出现滞后

您有起点吗?

我考虑过!但不要呆在中心

 com.google.ar.sceneform.Camera camera = arFragment.getArSceneView().getScene().getCamera();
    MaterialFactory.makeTransparentWithColor(MainActivity.this, new com.google.ar.sceneform.rendering.Color(Color.parseColor("#ff333d")))
            .thenAccept(material -> {
                nodeRenderable = ShapeFactory.makeSphere(0.008f, new Vector3(camera.getWorldPosition().x, camera.getWorldPosition().y,  camera.getWorldPosition().z), material);

enter image description here

android target arcore sceneform plane
1个回答
0
投票

您应该做的是创建一个Node并将其添加为场景的子级。

然后在每个Node.onUpdate(FrameTime)上执行这些步骤

  • 从ArSceneView的中心执行一次hitTest
  • 找到第一个命中的蜜蜂和一个isPoseInPolygon()== true
  • 更新Node worldPosition和worldRotation以匹配命中姿势平移和旋转

您可以看一下这个Reticle类,它正是在这样做:https://github.com/SimonMarquis/AR-Toolbox/blob/fb31a9cfdf061104a4401cecc9bc73ffa7ad33e6/app/src/main/java/fr/smarquis/ar_toolbox/Settings.kt#L124-L185

© www.soinside.com 2019 - 2024. All rights reserved.