【发布时间】:2020-06-17 21:01:15
【问题描述】:
我必须绘制一个类似于 Just A Line AR 应用程序的应用程序,但在我的应用程序中,应该在更改相机位置时呈现线条,并且不需要在屏幕上点击/按住。如何实现?
【问题讨论】:
标签: android-studio opengl-es augmented-reality arcore sceneform
我必须绘制一个类似于 Just A Line AR 应用程序的应用程序,但在我的应用程序中,应该在更改相机位置时呈现线条,并且不需要在屏幕上点击/按住。如何实现?
【问题讨论】:
标签: android-studio opengl-es augmented-reality arcore sceneform
我假设你的意思是你希望你的线锚定在场景中 - 即当你移动设备时,线上的点跟随相机视图的中心。
假设你可以:
此代码将在相机前面放置一个锚点:
//Add an Anchor and a renderable in front of the camera
Session session = arFragment.getArSceneView().getSession();
float[] pos = { 0, 0, -1 };
float[] rotation = { 0, 0, 0, 1 };
Anchor anchor = session.createAnchor(new Pose(pos, rotation));
anchorNode = new AnchorNode(anchor);
anchorNode.setRenderable(andyRenderable);
anchorNode.setParent(arFragment.getArSceneView().getScene());
【讨论】: