Search code examples
ios11xcode9-betaarkit

How to place 3D model using ARKit iOS 11 with some custom background view without using camera?


I am working on an Augmented Reality iOS app for which i am using ARKIT of iOS 11 beta. I am using ARSCNView(SceneKit) to render my .scn object. I have followed the sample given by apple in order to create an ARSession(https://developer.apple.com/sample-code/wwdc/2017/PlacingObjects.zip). Is it possible to place the 3D model with custom background instead of camera?

Like user can select the background color or can provide custom 2D photos as background?


Solution

  • Your view has a scene property where you can set the background to a color or an image:

     view.scene.background.contents = UIColor.red
    
     let myImage: UIImage = ... 
     view.scene.background.contents = myImage