title: How to detect touch and show new SCNPlane using ARKit?
body: <p>Now I am able to show different <code>SCNPlane</code>, when card detected. After displaying <code>SCNPlanes</code>, the user touches any plane to show new <code>SCNPlane</code>. But right now touch is working properly but new <code>SCNPlane</code> is not showing.</p>
  
  <p>Here is the code I've tried:</p>
  
  <pre><code>var cake_1_PlaneNode : SCNNode? = nil
  
  func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
  
      guard let imageAnchor = anchor as? ARImageAnchor else { return }
  
      if let imageName  = imageAnchor.referenceImage.name {            
          print(imageName)
  
          if imageName == "menu" {
  
              // Check To See The Detected Size Of Our menu Card (Should By 5cm*3cm)
              let menuCardWidth = imageAnchor.referenceImage.physicalSize.width
              let menuCardHeight =  imageAnchor.referenceImage.physicalSize.height
  
              print(
                  """
                  We Have Detected menu Card With Name \(imageName)
                  \(imageName)'s Width Is \(menuCardWidth)
                  \(imageName)'s Height Is \(menuCardHeight)
                  """)
  
              //raspberry
              //cake 1
  
              let cake_1_Plane = SCNPlane(width: 0.045, height: 0.045)
              cake_1_Plane.firstMaterial?.diffuse.contents = UIImage(named: "france")
              cake_1_Plane.cornerRadius = 0.01
  
              let cake_1_PlaneNode = SCNNode(geometry: cake_1_Plane)
              self.cake_1_PlaneNode = cake_1_PlaneNode
              cake_1_PlaneNode.eulerAngles.x = -.pi/2
              cake_1_PlaneNode.runAction(SCNAction.moveBy(x: 0.15, y: 0, z: -0.125, duration: 0.75))
  
              node.addChildNode(cake_1_PlaneNode)
              self.sceneView.scene.rootNode.addChildNode(node)                
          }  
     }       
  
     override func touchesBegan(_ touches: Set&lt;UITouch&gt;, with event: UIEvent?) {
  
      let touch = touches.first as! UITouch
      if(touch.view == self.sceneView){
          //print("touch working")
          let viewTouchLocation:CGPoint = touch.location(in: sceneView)
          guard let result = sceneView.hitTest(viewTouchLocation, options: nil).first else {
              return
          }
  
          if let planeNode = cake_1_PlaneNode, cake_1_PlaneNode == result.node{
              print("match")
              cake_1() 
          }
      }
  }
  
  func cake_1() {
  
      let plane = SCNPlane(width: 0.15  , height: 0.15)
      plane.firstMaterial?.diffuse.contents = UIColor.black.withAlphaComponent(0.75)
  
      let planeNodee = SCNNode(geometry: plane)
      planeNodee.eulerAngles.x = -.pi / 2
      planeNodee.runAction(SCNAction.moveBy(x: 0.21, y: 0, z: 0, duration: 0))
  
  } //cake_1
  </code></pre>
  
  <p>Follow this link: <a href="https://stackoverflow.com/questions/48854151/detect-touch-on-scnnode-in-arkit">Detect touch on SCNNode in ARKit</a>.</p>