As I am trying to run the application with the vision Pro, I receive following error:
ar_image_tracking_provider_t <0x303d45340>: Failed to set up image tracking with error: No images were supplied.
this is my funciton
import Foundation
import RealityKit
import ARKit
import RealityKitContent
var arkitSession = ARKitSession()
@MainActor class ARKitViewModel: ObservableObject{
private let session = ARKitSession()
private let imageTracking = ImageTrackingProvider(referenceImages: ReferenceImage.loadReferenceImages(inGroupNamed: "ref"))
var entityMap : [UUID: ModelEntity] = [:]
func runSession() async {
Task {
do {
try await arkitSession.run([imageTracking])
} catch {
print("Error: (error)")
}
}
}
var material = SimpleMaterial()
var rootEntity = Entity()
func updateImage(_ anchor: ImageAnchor) {
if entityMap[anchor.id] == nil {
let entity = ModelEntity(mesh: .generateSphere(radius: 0.05))
entityMap[anchor.id] = entity
rootEntity.addChild(entity)
entity.transform = Transform(matrix: anchor.originFromAnchorTransform)
}
}
func processUpdates() async {
for await _ in imageTracking.anchorUpdates{
print("test")
}
}
}
i don’t know why it failed to set up and basically i am trying to use this code to detect and object ,static one?
matt is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.