I developed a Plane-detection using ARKit in the visionOS app:
import SwiftUI
import RealityKit
import ARKit
struct ContentView: View {
@State private var ok = false
let session = ARKitSession()
let planeData = PlaneDetectionProvider(alignments: [.horizontal, .vertical])
var body: some View {
Group {
if !ok {
TabelView()
} else {
SwiftUIView()
}
}
.onAppear{
Task {
try await session.run([planeData])
for await update in planeData.anchorUpdates {
if update.anchor.classification == .table { continue }
switch update.event {
case .added, .updated:
ok = true
case .removed:
ok = false
}
}
}
}
}
}
When I ran it, I found that Xcode told me that it does not support Simulator, so how can I test this program? If there is no other way other than applying for VisionPro DevKit and participating in Lab, I hope you can tell me that this View is Can the following functions be realized:
When there is no table in the user's sight, SwiftUIView() will be displayed in the coordinates of x:0,y:0,z:0
. If there is a table in the user's sight, TabbelView() will be displayed on the table.
If you can't realize the above functions, I hope you can give me some advice. Thank you!