-
Explore as melhorias no rastreamento de objetos do visionOS
Descubra como o visionOS está aprimorando o rastreamento de objetos e a entrada de acessórios espaciais. Conheça novas formas de rastrear objetos móveis e portáteis, possibilitando a integração entre os mundos físico e digital. Confira as novas classes de acessórios espaciais compatíveis e o que é necessário para criar seus próprios acessórios personalizados a fim de viabilizar modelos de interação únicos em seus apps.
Capítulos
- 0:00 - Introdução
- 2:20 - Rastreamento de objetos
- 7:20 - Acessórios espaciais
- 7:47 - Criando um acessório espacial
- 11:48 - Acessórios plug-and-play
- 12:22 - Implementando no seu app
- 13:03 - Próximas etapas
Recursos
- Implementing object tracking in your app
- Working with generic spatial accessories
- Preparing spatial accessories for tracking in your visionOS app
- Spatial accessory design guidelines for Apple devices (check section 20)
- Exploring object tracking with ARKit
Vídeos relacionados
WWDC25
WWDC24
-
Buscar neste vídeo...
-
-
3:50 - Enable high frame rate tracking
// Enable high frame rate tracking // Create reference object configuration var configuration = ReferenceObject.Configuration() configuration.highFrameRateTrackingEnabled = true // Load the reference object with ARKit API let refObjURL = Bundle.main.url(forResource: "flashlight", withExtension: ".referenceobject") let refObject = try? await ReferenceObject(from: refObjURL!, configuration: configuration) -
4:50 - Extended training mode via command-line
// Extended training mode on Mac using command-line interface % xrun createml objecttracker --source flashlight.usdz --output flashlight.referenceobject --training-mode extended --all-angles -
5:25 - Object pose coordinate spaces
// Different object pose spaces // Obtain anchor transform with display corrections let renderingPose = myObjectAnchor.coordinateSpace(correction: .rendered) // Obtain anchor transform in metric space let metricPose = myObjectAnchor.coordinateSpace(correction: .none) -
6:22 - Implement object tracking in iOS
// Implement object tracking in iOS import ARKit import RealityKit class ObjectTrackingARSessionDelegate: NSObject, ARSessionDelegate { let arView = ARView(frame: .zero) var entities: [UUID: AnchorEntity] = [:] func start() throws { let stationaryObject = try ARReferenceObject(archiveURL: Bundle.main.url(forResource: "stationary", withExtension: "referenceobject")!) let movingObject = try ARReferenceObject(archiveURL: Bundle.main.url(forResource: "moving", withExtension: "referenceobject")!) let configuration = ARWorldTrackingConfiguration() configuration.detectionObjects = [stationaryObject] // Low frame rate configuration.trackingObjects = [movingObject] // High frame rate arView.session.delegate = self arView.session.run(configuration) } func session(_ session: ARSession, didAdd anchors: [ARAnchor]) { for case let anchor as ARObjectAnchor in anchors { let entity = AnchorEntity(anchor: anchor) entities[anchor.identifier] = entity arView.scene.addAnchor(entity) } } func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) { for case let anchor as ARObjectAnchor in anchors { entities[anchor.identifier]?.isEnabled = anchor.isTracked } } func session(_ session: ARSession, didRemove anchors: [ARAnchor]) { for case let anchor as ARObjectAnchor in anchors { if let entity = entities.removeValue(forKey: anchor.identifier) { arView.scene.removeAnchor(entity) } } } } -
12:26 - Discover and connect a spatial accessory
import ARKit import GameController // Generic accessory discovery if let device = GCSpatialAccessory.spatialAccessories.first { // Resolves the .referenceaccessory bundle automatically let accessory = try await Accessory(device: device) let provider = AccessoryTrackingProvider(accessories: [accessory]) try await arkitSession.run([provider]) } // Update tracked accessories without restarting the session try await provider.updateAccessories([newAccessory])
-