I want to create an app same like magicplan and want to draw continuous green vertical pipe same like magicplan which goes near and far as camera moves.
I have tried below code but it keeps node at center of screen. Please help me how I can achieve this.
Ray ray = arFragment.getArSceneView().getScene().getCamera().screenPointToRay(arFragment.getArSceneView().getWidth() / 2, arFragment.getArSceneView().getHeight() / 2);
Vector3 localpos = ray.getPoint(1f);
Quaternion localRotation = arFragment.getArSceneView().getScene().getCamera().getLocalRotation();
Vector3 localScale = new Vector3(0.3f,0.3f,0.3f);
Frame frame = arFragment.getArSceneView().getArFrame();
Vector3 pos;
pos = Vector3.add(ray.getOrigin(), ray.getDirection());
Pose pose = Pose.makeTranslation(pos.x, pos.y, pos.z);
anchor = arFragment.getArSceneView().getSession().createAnchor(pose);
anchorNode = new AnchorNode(anchor);
anchorNode.setParent(arFragment.getArSceneView().getScene());
TransformationSystem transformationSystem = arFragment.getTransformationSystem();
node = new TransformableNode(transformationSystem);
node.setRenderable(cylinderRenderable2);
node.setParent(anchorNode);
node.setLocalPosition(localpos);
node.setLocalRotation(localRotation);
node.setLocalScale(localScale);
node.select();