I have a USDZ model called 'GooseNModel' in the visionOS App project. I'm sure that this model contains an animation, so I wrote the following code to display the model with animation:
import SwiftUI
import RealityKit
RealityView{ content in
if let GooseNModel = try? await Entity(named: "GooseNModel"),
let animation = GooseNModel.availableAnimations.first {
GooseNModel.playAnimation(animation)
content.add(GooseNModel)
}
}
But when I ran it, I found that it did not contain animation as I imagined, but a static model. How to solve it?