iOS Development

How you can know if a usdz mannequin accommodates animations & animate it in iOS swift utilizing SceneKit?

I want assist in perceive the right way to know if a usdz mannequin accommodates animation & if sure animate it from one state to a different state. Under is my code

class ViewController: UIViewController {
    @IBOutlet weak var sceneKitView: SCNView!
    override func viewDidLoad() {
    func load3dModelFromAsset(){
        let scene = SCNScene(named: "fox.usdz")
        let lightNode = SCNNode()
        lightNode.gentle = SCNLight()
        lightNode.gentle?.kind = .omni = SCNVector3(x: 0, y: 10, z: 35)
        let ambientLightNode = SCNNode()
        ambientLightNode.gentle = SCNLight()
        ambientLightNode.gentle?.kind = .ambient
        ambientLightNode.gentle?.shade = UIColor.darkGray
        sceneKitView.allowsCameraControl = true
        sceneKitView.backgroundColor = UIColor.white
        sceneKitView.cameraControlConfiguration.allowsTranslation = false
        sceneKitView.scene = scene

        debugPrint("size (String(describing: scene?.rootNode.animationKeys.depend))")
        if let animationKeys = scene?.rootNode.animationKeys {
            for key in animationKeys {
                print("Animation Key: (key)")

When I attempt to print the animation keys depend in my above code I at all times get zero. I’ve used usdz mannequin from over right here

I’m not certain if the fashions current in above url has a number of animations or not as I need to animate from one state to the opposite

One other approach I attempted was utilizing gltf mannequin of this fox which accommodates 3 states of animations so i opened it in blender and click on on the export button as usd after which I opened the usd file in Xcode and once more exported it in usdz. Whereas exporting from blender I did test the animations checkbox as properly however nonetheless once I run the code I get the animation keys as zero.

I’m not a 3d artist so do not know the right way to create a usdz mannequin of my very own with animations


Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button