我是新手,目前正在旧版本上构建与AR相关的应用程序
let results = self.hitTest(screenPosition, types: [.featurePoint])
现在我有一个问题,在iOS 14.0中不推荐使用hitTesthitTest(_:types:)' was deprecated in iOS 14.0: Use [ARSCNView raycastQueryFromPoint:allowingTarget:alignment]
请为我提供解决方法的建议,谢谢:)
最佳答案
是的,使用raycastQuery(from:allowing:alignment:)
如Xcode所建议的那样:
...
let location = gesture.location(in: sceneView)
guard let query = sceneView.raycastQuery(from: location, allowing: .existingPlaneInfinite, alignment: .any) else {
return
}
let results = sceneView.session.raycast(query)
guard let hitTestResult = results.first else {
print("No surface found")
return
}
...
关于ios - iOS 14.0中不推荐使用'hotTest()',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64258067/