Search code examples
swiftaugmented-realityscenekitarkitfrustum

ARKit – How to know if 3d object is in the center of a screen?


I place 3d object in the world space. After that I try to move camera randomly. Then right now I need to know after I knew object has became inside frustum by isNode method, if the object is in center, top or bottom of camera view.


Solution

  • I solved problem with another way:

     let results = self.sceneView.hitTest(screenCenter!, options: [SCNHitTestOption.rootNode: parentnode])
    

    where parentnode is the parent of target node, because I have multiple nodes.