Reputation: 33
I have to draw an app similar to Just A Line AR App but in my app,lines should be rendered as camera position is changed and should not require tapping/holding on the screen. How can it be achieved?
Upvotes: 0
Views: 545
Reputation: 25491
I assume you mean you want your line to be anchored in the scene - i.e. the points on the line follow the centre of the camera view as you move the device around.
Assuming this you can:
This code will place an anchor in front of the camera:
//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());
Upvotes: 1