I'm currently building an AR app with Swift and would like to convert this type of thing: let arHitTestResults : [ARHitTestResult] = sceneView.hitTest(screenCentre, types: [.featurePoint]) (which is no longer available in iOS 14) to this: let arResults: [ARRaycastResult] = sceneView.raycastQuery(from: tapLocation, allowing: existingPln, alignment: alignment)
but systematically get this message: Cannot convert value of type 'ARRaycastQuery?' to specified type '[ARRaycastResult]'
What can I do?
Thanks for your answers!
@objc func handleTap(gestureRecognize: UITapGestureRecognizer) {
let screenCentre: CGPoint = CGPoint(x: self.sceneView.bounds.midX,
y: self.sceneView.bounds.midY)
let tapLocation: CGPoint = screenCentre
let existingPln: ARRaycastQuery.Target = .existingPlaneGeometry
let alignment: ARRaycastQuery.TargetAlignment = .vertical
let arResults: [ARRaycastResult] = sceneView.raycastQuery(from: tapLocation,
allowing: existingPln,
alignment: alignment)
}