iPhoneX 上可以同时运行 ARWorldTracking Session 和ARFaceTracking Session 吗?

Is it possible to run ARWorldTracking Session and ARFaceTracking Session at the same time on iPhoneX?

我正在尝试 运行 在 iPhoneX 上同时进行 ARWorldTracking Session 和 ARFaceTracking Session, 但是第一个 运行ning 会话在后面的会话开始 运行.

后停止

是不可能实现的吗? 这是我的 ViewController.swift 代码。

import UIKit
import ARKit

class ViewController: UIViewController, ARSCNViewDelegate, 
ARSessionDelegate {
    @IBOutlet weak var frontView: ARSCNView!
    @IBOutlet weak var backView: ARSCNView!
    override func viewDidLoad() {
       super.viewDidLoad()
       startTracking()
    }

   func startTracking() {
       let backConfiguration = ARWorldTrackingConfiguration()
       backView.session.run(backConfiguration)

       let frontConfiguration = ARFaceTrackingConfiguration()
       frontConfiguration.isLightEstimationEnabled = true      
       frontView.session.run(frontConfiguration)
  }
}

ARSession 是单例,因此更改配置将更改共享会话的状态。来自文档:

ARSession A shared object that manages the device camera and motion processing needed for augmented reality experiences.

没有。

ARKit 依赖于 AVCapture 系统,并且不支持一次使用多个捕获设备(相机)。如果您使用前置摄像头启动一个捕获会话,而另一个会话正在使用后置摄像头,则现有会话将停止。