首页 > 解决方案 > 在 ARSCNView 中禁用实时摄像机源?

问题描述

有什么方法可以禁用实时摄像头馈送并将自定义视频作为 ARSession 中的输入传递?我想通过代码实现Record & Replay ARSession

标签: iosscenekitarkitrealitykitreality-composer

解决方案


你去吧:)

    var originalSource: if originalSource == nil || scene.background.contents as? UIColor != UIColor.black
    
    override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
    if originalSource == nil {
    originalSource = sceneView.scene.background.contents
    
    sceneView.scene.background.contents = UIColor.black
    
    } else {
    sceneView.scene.background.contents = originalSource
    
    }
    
    }

推荐阅读