ARView 中的故障
Glitch in ARView
我有一个 iOS 应用程序,您可以在其中通过点击按钮打开 AR 视图。然而,在从我的导航控制器弹出视图并再次点击 AR 按钮后,相机源中发生了一些异常情况。我看到在整个会话期间来来去去的前一个 ar 会话的最后一帧突然出现。我正在使用 RealityKit。有什么想法吗?
override func viewDidLoad() {
super.viewDidLoad()
focusSquare = FocusEntity(on: arview, style: .classic(color: .yellow))
setupCoachingOverlay()
}
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.isNavigationBarHidden = true
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIApplication.shared.isIdleTimerDisabled = true
resetTracking()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
arview.session.pause()
}
deinit{
arview.session.delegate = nil
arview.scene.anchors.removeAll()
arview.removeFromSuperview()
arview = nil
}
func resetTracking() {
arview.automaticallyConfigureSession = false
let configuration = ARWorldTrackingConfiguration()
configuration.planeDetection = [.horizontal, .vertical]
arview.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
arview.scene.addAnchor(anchor)
}
看来是 FocusSquare 出了问题。现在已经修复了,我已经删除了它。
我有一个 iOS 应用程序,您可以在其中通过点击按钮打开 AR 视图。然而,在从我的导航控制器弹出视图并再次点击 AR 按钮后,相机源中发生了一些异常情况。我看到在整个会话期间来来去去的前一个 ar 会话的最后一帧突然出现。我正在使用 RealityKit。有什么想法吗?
override func viewDidLoad() {
super.viewDidLoad()
focusSquare = FocusEntity(on: arview, style: .classic(color: .yellow))
setupCoachingOverlay()
}
override func viewWillAppear(_ animated: Bool) {
self.navigationController?.isNavigationBarHidden = true
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
UIApplication.shared.isIdleTimerDisabled = true
resetTracking()
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
arview.session.pause()
}
deinit{
arview.session.delegate = nil
arview.scene.anchors.removeAll()
arview.removeFromSuperview()
arview = nil
}
func resetTracking() {
arview.automaticallyConfigureSession = false
let configuration = ARWorldTrackingConfiguration()
configuration.planeDetection = [.horizontal, .vertical]
arview.session.run(configuration, options: [.resetTracking, .removeExistingAnchors])
arview.scene.addAnchor(anchor)
}
看来是 FocusSquare 出了问题。现在已经修复了,我已经删除了它。