1

I am currently following a previous post to create a mirror image of a camera feed for an ARKit app. I have gotten the app to build with the plist and metal files, but am having difficulty figuring out the final step of where to place the technique assignment within the ViewController. If I put it within the "ViewDidLoad" function, the app appeared to flip how the world axes were oriented, but did not change the camera feed at all. It also does not appear to work within the "ViewWillAppear" function. Where exactly would I need to put this in order for the assignment to affect the camera feed? Or is there something else that would be causing this assignment to affect the coordinate system but not the camera feed?

Edit: Adding this segment of code that assigns the technique to the SceneView also seems to affect the coordinate system tracking, as the axes within the app move around a significant amount when this is present:

    if let path = Bundle.main.path(forResource: "MirrorCamera", ofType: "plist") {
    if let dict = NSDictionary(contentsOfFile: path)  {
        let dict2 = dict as! [String : AnyObject]
        let technique = SCNTechnique(dictionary:dict2)
        sceneView.technique = technique
    }
}

Edit 2: It appears that putting the above code into "ViewDidAppear" made the mirroring work correctly, however the coordinate plane is still moving around a great deal, and the mirroring seems to always stop after a while. It seems to happen as soon as one of the images I am tracking comes into the video frame, but has happened when viewing completely unrelated surroundings. Is there something that would trigger it to stop applying the mirror when it detects an image, or could this be as simple as the phone not being able to keep up with the mirroring?

Charlie
  • 136
  • 1
  • 8

0 Answers0