我有一个RealityKit‘s ARView
的子类,它具有以下函数来进行光线投射:
func makeRaycastQuery(alignmentType: ARRaycastQuery.TargetAlignment) -> simd_float4x4? {
let results = self.raycast(from: self.center,
// Better for pinning to planes
allowing: .estimatedPlane,
alignment: alignmentType)
// We don't care about changing scale on raycast so keep it the same
guard var result = results.first?.worldTransform else { return nil }
result.scale = SCNVector3(1, 1, 1)
return result
}
然而,我的results
数组总是空的.在设置ARView
以启用光线投射时,是否需要进行其他配置?