Search code examples
swiftaugmented-realityarkitrealitykit

How to disable camera feed while keeping LiDAR debug mesh?


I'm running an iOS14 ARSession on a LiDAR enabled device, and have it output the mesh overlay that it is dynamically creating over the camera feed.

Is it possible to disable the camera feed for the ARView or ARSession, while still seeing the debug mesh overlay?

Here's how I'm showing the mesh overlay:

arView.debugOptions.insert(.showSceneUnderstanding)

What I want to see: black screen with colored lines representing mesh vertices and faces.


Solution

  • Yes, it's possible to disable a camera feed while keeping only LiDAR debug mesh:

    @IBOutlet var arView: ARView!
    
    arView.environment.background = .color(.black)
    

    ...and if you need to get your camera feed back just use:

    arView.environment.background = .cameraFeed()