10

I'm trying to make a 3d model like robot provided by Apple in Motion Capture example (shown at WWDC 2019) which can mimic me in motion capture ARKit 3.0 by replacing robot character given by Apple.

Desired Solution:

  • Is there any special software which Apple used to create robot.usdz file? If yes, then please provide details for it?

  • How can we convert formats like .glb/.gltf/.obj/.dae file to .usdz using Apple’s Python based tool without affecting it’s scene graph?

  • How can we edit the scene graph of a .usdz file in Xcode and successfully save the changes in a .usdz file?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
Ameer Hamza
  • 103
  • 7

1 Answers1

2

Working ARKit's MoCap solution

enter image description here

Here's my post where you'll find instructions how to create a .zshrc file in macOS.

Load MoCap'ed model in RealityKit:

import RealityKit
import ARKit

class ViewController: UIViewController, ARSessionDelegate {

    @IBOutlet var arView: ARView!
    
    var character: Entity?
    let characterAnchor = AnchorEntity()
    
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(animated)

        arView.session.delegate = self

        guard ARBodyTrackingConfiguration.isSupported
        else { fatalError("MoCap is available on A12 & later") }
        
        let config = ARBodyTrackingConfiguration()
        arView.session.run(config)
        arView.scene.addAnchor(characterAnchor)
        
        character = try? Entity.load(named: "character")
    }
    
    func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
        
        for anchor in anchors {
            
            guard let bodyAnchor = anchor as? ARBodyAnchor
            else { continue }

            let bodyPosition = simd_make_float3(bodyAnchor.transform.columns.3)
            characterAnchor.position = bodyPosition
            characterAnchor.orientation = Transform(matrix: bodyAnchor.transform).rotation

            if let character = character, character.parent == nil {

                characterAnchor.addChild(character)
                characterAnchor.scale = [0.02, 0.02, 0.02]
            }
        }
    }
}
Andy Jazz
  • 49,178
  • 17
  • 136
  • 220