Twan
Twan

Reputation: 21

Apple Vision Pro Reality Kit detecting separate parts in 3d model with Blender or Reality Composer Pro

I have succesfully loaded an USDZ file and are able to transformations on the whole model. Now I want to highlight a part of the object when you tap on it.

Issue is that I can not get the USDZ file to get separated parts under root.

Goal is to perform transformations like color change on separate parts by tapping or looking at them.

This should be the outcome:

Wanted: Output from code

But this is my debug outcome:

Real debug hierarchy

I tried changing the hierarchie to set all objects under root with Reality Composer Pro like this:

Reality Composer Pro Hierarchy

Also tried with Blender.

The code for debugging the hierarchy in code:

    func printEntityHierarchy(_ entity: Entity, level: Int = 0) {
    let prefix = String(repeating: "  ", count: level)
    print("\(prefix)🔹 \(entity.name) - \(type(of: entity))")
    
    for child in entity.children {
        printEntityHierarchy(child, level: level + 1)
    }
}

// Call this function after loading the model
if let modelEntity = modelEntity {
    printEntityHierarchy(modelEntity)
}

Can anyone help me to better understand how I can check the real hierarchy of the USDZ file? Or a way to generate an USDZ with the correct hierachy?

Current App in simulator

Upvotes: 1

Views: 43

Answers (0)

Related Questions