0 Replies
      Latest reply on Jun 29, 2018 5:18 AM by gregoryyoung
      gregoryyoung Level 1 Level 1 (0 points)

        Hi, I'm writing an application that tracks disks with images on them with ARKit, and I'd like to show text next to the disks. Currently, I have it detecting the disks and creating a translucent SCNCylinder over them which works fine. I'd like an SCNText object to hover next to them, but am having issues getting the SCNText object to appear at all. Here is my renderer(_:didAdd:for:) function:

         

            func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
                
                guard anchor is ARImageAnchor else { return }
                guard let imageAnchor = anchor as? ARImageAnchor else { return }
                let referenceImage = imageAnchor.referenceImage
                
                let lbl = SCNText(string: "test", extrusionDepth: 0)
                let lblNode = SCNNode(geometry: lbl)
                node.addChildNode(lblNode)
                
                
                
                let cyl = SCNCylinder(radius: referenceImage.physicalSize.width/2, height: 0.01)
                let cylNode = SCNNode(geometry: cyl)
                cylNode.opacity = 0.3
                node.addChildNode(cylNode)
        
            }

         

        Lines 3-5 and 13-16 work as expected, but I'm not getting anything from lines 7-9. It appears that it does not even attempt to create an object (I'm assuming with the code as is it will create misplaced text in a huge font).

         

        I have ARSCNView.showStatistics to true and the number next to the diamond (not sure what it means but I believe it has something to do with number of objects rendered) does not go up when lines 13-16 are commented out, but it does go up when they aren't commented out.

         

        I'm assuming I have an issue with my code, but I'm not sure what it could be due to lack of documentation. Also might be a bug with the ARKit beta, but I'm not experienced enough to know for sure. Some advice would be very appreciated.

         

        Using iOS 12 dev b2 and Xcode 10 b2.