title: How to draw a line in arkit based on CLLocation in iOS Swift?
body: <p>I am trying to use <code>ARKit</code> for outdoor navigation. I have used <code>mapbox</code> for AR navigation and used <code>mapboxarkit</code> and <code>mapboxDirection</code> cocoapods.</p>
  
  <p>The nodes are shown as paths. I am able to show paths as dotted shperes or planes but am not able show them as lines. Here are my output screenshots</p>
  
  <p>This is the node, which I have tried to show as a line breaking and tried to adjust <code>scnbox</code> to be straight and show as a line:
  <img src="https://i.stack.imgur.com/9j52r.png" alt="This is the node, which I have tried to show as a line breaking and tried to adjust &lt;code&gt;scnbox&lt;/code&gt; to be straight and show as a line">.</p>
  
  <p>This is the result I expect: </p>
  
  <p><img src="https://i.stack.imgur.com/YvjZe.png" alt="I want an AR line like this."></p>
  
  <p>Here is the code I have tried so far - Here is the code to add an AR annotation and AR line.</p>
  
  <pre><code>if let route = routes?.first, let leg = route.legs.first {
      var polyline = [CLLocationCoordinate2D]()
  
      // Add an AR node and map view annotation for every defined "step" in the route
      for step in leg.steps {
          let coordinate = step.coordinates!.first!
          polyline.append(coordinate)
          let stepLocation = CLLocation(latitude: coordinate.latitude, longitude: coordinate.longitude)
  
          // Update feature collection for map view
          self.updateShapeCollectionFeature(&amp;self.waypointShapeCollectionFeature, with: stepLocation, typeKey: "waypoint-type", typeAttribute: "big")
  
          // Add an AR node
          let annotation = Annotation(location: stepLocation, calloutImage: self.calloutImage(for: step.description))
          annotationsToAdd.append(annotation)
      }
  
      let metersPerNode: CLLocationDistance = 1
      let turfPolyline = Polyline(polyline)
  
      // Walk the route line and add a small AR node and map view annotation every metersPerNode
      for i in stride(from: metersPerNode, to: turfPolyline.distance() - metersPerNode, by: metersPerNode) {            
          // Use Turf to find the coordinate of each incremented distance along the polyline
          if let nextCoordinate = turfPolyline.coordinateFromStart(distance: i) {
              let interpolatedStepLocation = CLLocation(latitude: nextCoordinate.latitude, longitude: nextCoordinate.longitude)
  
              // Update feature collection for map view
              self.updateShapeCollectionFeature(&amp;self.waypointShapeCollectionFeature, with: interpolatedStepLocation, typeKey: "waypoint-type", typeAttribute: "small")
  
              // Add an AR node
              let annotation = Annotation(location: interpolatedStepLocation, calloutImage: nil)
              annotationsToAdd.append(annotation)
          }
      }
  }
  </code></pre>
  
  <p>Here is the code for creating a <code>scnplane</code>:</p>
  
  <pre><code>func createLightBulbNode() -&gt; SCNNode {
      let lightBulbNode = collada2SCNNode(filepath: "art.scnassets/cubeSolid.dae")
  
      lightBulbNode.position = SCNVector3(0, -0.5, 0)
  
      return lightBulbNode
  }
  
  func collada2SCNNode(filepath:String) -&gt; SCNNode {
      let node = SCNNode()
      let scene = SCNScene(named: filepath, inDirectory: nil, options: [SCNSceneSource.LoadingOption.animationImportPolicy: SCNSceneSource.AnimationImportPolicy.doNotPlay])
      let nodeArray = scene!.rootNode.childNodes
      for childNode in nodeArray {
          node.addChildNode(childNode as SCNNode)
      }
      return node
  }
  
  func node(for annotation: Annotation) -&gt; SCNNode? {    
      if annotation.calloutImage == nil {
          // Comment `createLightBulbNode` and add `return nil` to use the default node
          return createLightBulbNode()
      } else {
          let firstColor = UIColor(red: 0.0, green: 99/255.0, blue: 175/255.0, alpha: 1.0)
          return createSphereNode(with: 0.5, firstColor: firstColor, secondColor: UIColor.green)
      }
  }
  </code></pre>