title: Rendering/displaying a navigation path with renderables in ARCore?
body: <p>I am currently developing an indoor augmented reality navigation android application and I am struggling using Google ARCore with Sceneform to create a navigation path from my current location to the destination (my question is about rendering and displaying, I already have my location necessities sorted out). </p>
  
  <p>If someone could describe to me conceptually, or with code, a good strategy to iteratively render an <code>arrowRenderable</code> at different positions I would be very appreciative (for example, do I use Poses, setWorldPosition(), setLocalPosition(), etc...). I can convert (lat,long) to camera space as well so I am really looking to understand ARCore rendering better.</p>
  
  <p>Thank you in advance and please let me know if you would like additional information. </p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>In regards to my implementation, I am using IndoorAtlas to handle my indoor positioning. The IndoorAtlas Android SDK comes with a wayfinding capability that creates routes from your current location to a destination (this is loaded in from a previously set wayfinding graph through IndoorAtlas online toolset). These routes are composed of legs that have a beginning and ending (lat,long) coordinates. What I am trying to do is render objects in AR iteratively along the ending (lat,long) coordinates. </p>
  
  <p>Here is an example of one implementation I tried: </p>
  
  <pre><code>public void createNavigationPath() {
          // loop through the wayfinding route
          for (IARoutingLeg leg : mCurrentRoute) {
  
              // current loc
              Location currentLoc = new Location("Current Location");
              currentLoc.setLatitude(mLocation.latitude);
              currentLoc.setLongitude(mLocation.latitude);
  
              // end of wayfinding route segment
              Location legEnd = new Location("Leg End");
              legEnd.setLatitude(leg.getEnd().getLatitude());
              legEnd.setLongitude(leg.getEnd().getLongitude());
  
              // conversion from (lat,long) to camera space
              // conversion implementation credit:  
              // https://github.com/dat-ng/ar-location-based-android
              float[] currentLocationInECEF = WSG84toECEF(currentLoc);
              float[] pointInECEF = WSG84toECEF(legEnd);
              float[] pointInENU = ECEFtoENU(currentLoc, currentLocationInECEF, pointInECEF);
  
              float[] cameraCoordinateVector = new float[4];
  
              Matrix.multiplyMV(cameraCoordinateVector, 0, mRotatedProjectionMatrix, 0, pointInENU, 0);
  
              Frame frame = arFragment.getArSceneView().getArFrame();
  
              // cameraCoordinateVector[2] is z, that always less than 0 to display on right position
              // if z &gt; 0, the point will display on the opposite
              if (cameraCoordinateVector[2] &lt; 0) {
                  float x = (0.5f + cameraCoordinateVector[0] / cameraCoordinateVector[3]) * arFragment.getArSceneView().getWidth();
                  float y = (0.5f - cameraCoordinateVector[1] / cameraCoordinateVector[3]) * arFragment.getArSceneView().getHeight();
  
                  // Pose pose = new Pose(new float[]{x,y,cameraCoordinateVector[2]}, new float[]{0,0,0});
  
                  Anchor anchor = arFragment.getArSceneView().getSession().createAnchor(frame.getCamera().getPose().compose(Pose.makeTranslation(x,y,cameraCoordinateVector[2])).extractTranslation());
                  AnchorNode anchorNode = new AnchorNode(anchor);
  
                  Node tempNode = new Node();
                  tempNode.setParent(anchorNode);
                  tempNode.setRenderable(arrowRenderable);
  
                  Log.d(TAG, "Render Completed");
              }
          }
      }
  </code></pre>
  
  <p>Alternatively, I have also tried to use some AR Geolocation SDKs like <a href="https://github.com/appoly/ARCore-Location" rel="nofollow noreferrer">https://github.com/appoly/ARCore-Location</a> but it was too inaccurate while moving. I have not tried the Wikitude SDK yet. </p>