Is there any way to improve ARKit Plane detection and Reduce the time consumed to detect it? Here we are detecting a horizontal plane thing is if we keep the camera steady it takes time to detect and it does not work on floors.
For table and other similar surfaces, it's taking around 5 to 6 sec. but for floor its more than 20 or half a minute and if we don't move the camera it does not work at all.
Here is my code:-
override func viewDidLoad() {
super.viewDidLoad()
SVProgressHUD.show(withStatus: "Detecting Plane and Getting ready")
sceneView.delegate = self
sceneView.session.delegate = self
sceneView.showsStatistics = false
let configuration = ARWorldTrackingConfiguration()
configuration.planeDetection = .horizontal
configuration.isLightEstimationEnabled = true
sceneView.session.run(configuration)
sceneView.debugOptions = [ARSCNDebugOptions.showFeaturePoints]
}
func renderer(_ renderer: SCNSceneRenderer, didAdd node: SCNNode, for anchor: ARAnchor) {
if currentAnchor == nil {
currentAnchor = anchor
let light = SCNLight()
light.type = .directional
light.color = UIColor(white: 1.0, alpha: 1.0)
light.shadowColor = UIColor(white: 0.0, alpha: 0.8).cgColor
let lightNode = SCNNode()
lightNode.eulerAngles = SCNVector3Make(-.pi / 3, .pi / 4, 0)
lightNode.light = light
sceneView.scene.rootNode.addChildNode(lightNode)
let ambientLight = SCNLight()
ambientLight.type = .ambient
ambientLight.color = UIColor(white: 0.8, alpha: 1.0)
let ambientNode = SCNNode()
ambientNode.light = ambientLight
sceneView.scene.rootNode.addChildNode(ambientNode)
}
}
}