I want to show, say andy once arcore tracking started and plan is discovered. After I anchored the node somewhere nearby and then i move away from andy.
I have an arrow at the bottom of the screen I want to rotate/point the arrow as i move away my camera such that the arrow always point to the anchored node.
I have done remaining thing but not able to find the angle to which i need to keep rotating the arrow image so that it always point towards anchored node.
I am using sceneform framework, arcore sdk in android studio.
Following is the code I used to achieve what was intended :
Vector3 cameraPosition = arSceneView.getScene().getCamera().getWorldPosition();
Vector3 catPosition = catNode.getWorldPosition();
Vector3 direction = Vector3.subtract(cameraPosition, catPosition);
Quaternion lookRotation = Quaternion.lookRotation(direction, Vector3.up());
catNode.setWorldRotation(lookRotation);