5

I have been working to learn how to perform 3D body tracking, using Apple's sample project. My goal is to replace the model in this project with my own 3D model, which I have built to match Apple's available "robot.usdz" sample included with that project.

I have successfully been able to import my 3D model into Xcode, after converting to USDZ, and attach the model to an ARBodyAnchor. However, my model (see attached screenshot) shows up in the expected location, but looks completely awry. I am loading the model;

var cancellable: AnyCancellable? = nil
        cancellable = Entity.loadBodyTrackedAsync(named: "character/mytest").sink(
            receiveCompletion: { completion in
                if case let .failure(error) = completion {
                    print("Error: Unable to load model: \(error.localizedDescription)")
                }
                cancellable?.cancel()
        }, receiveValue: { (character: Entity) in
            if let character = character as? BodyTrackedEntity {
                character.scale = [0.5, 0.5, 0.5]
                self.character = character
                cancellable?.cancel()
            } else {
                print("Error: Unable to load model as BodyTrackedEntity")
            }
        })

When I import this same model simply as an Entity, taking away the body tracking, I can attach it to either a horizontal plane or a body, and it loads normally. Something, therefore, is awry with the model for the purpose of 3D tracking.

Has anyone had success loading a custom 3D model into Xcode for use with body tracking?

Improper appearance of model when using body tracking (Improper appearance of model when using body tracking) Proper appearance of model when adding solely as an Entity (Proper appearance of model when adding solely as an Entity - body tracking not enabled here)

ZbadhabitZ
  • 2,753
  • 1
  • 25
  • 45

0 Answers0