         
     }
     
+    /* Uncomment this method to visualize "plane detection"
+     In other words, ARKit detects planes in the Real World to serve as anchors--so we can add a node to visualize them.
     func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
+        
         // This visualization covers only detected planes.
         guard let planeAnchor = anchor as? ARPlaneAnchor else { return }
         print("flat plane detected")

        if contact.nodeA.physicsBody?.categoryBitMask == CollisionCategory.ship.rawValue || contact.nodeB.physicsBody?.categoryBitMask == CollisionCategory.ship.rawValue {
            self.removeNodeWithAnimation(contact.nodeA)
            self.removeNodeWithAnimation(contact.nodeB)
            print("HIT SHIP")
           // DispatchQueue.main.asyncAfter(deadline: .now() + 1, execute: {
                self.addNewShip()
            //})
            
        }
    }

    func getUserDirection() -> SCNVector3 {
        if let frame = self.sceneView.session.currentFrame {
        let mat = SCNMatrix4FromMat4(frame.camera.transform)
            //print("matrix", mat)
            return SCNVector3(-1 * mat.m31, -1 * mat.m32, -1 * mat.m33)
        }
        return SCNVector3(0, 0, -1)
