Has anyone been able to access multiple animations stored in a USDZ file through the RealityKit APIs?
USDZ Animations with RealityKit
Add a Comment
Code Block modelEntity.availableAnimations.forEach { modelEntity.playAnimation($0.repeat()) }
Code Block print("DEBUG: animations-> \(modelEntity.availableAnimations)")
Code Block // Load the usdz as an Entity entity = try! Entity.load(contentsOf: url) // Add the entity to an anchor, add the anchor to the scene. The anchor might not be anchored in the scene at this point. anchor.addChild(entity) arView.scene.anchors.append(anchor) // Subscribe to AnchoredStateChanged events, play the animations of the anchor's children once it is active in the scene. arView.scene.subscribe(to: SceneEvents.AnchoredStateChanged.self) { [self] (event) in if anchor.isActive { for entity in anchor.children { for animation in entity.availableAnimations { entity.playAnimation(animation.repeat()) } } } }.store(in: &cancellables) // Remember to store the cancellable!
this doesn't work. I tried downloading a .usdz file from the internet. it had a animation in it. I was able to see the animation in the quicklook (rightclick->quicklook) on the file. But when I tried doing it on a real device with Xcode using RealityKit and ARKit. its didn't seem to work. Is there any new guidance?