I have been doing research on this topic for a while, and I am completely stumped.
I have loaded a USDZ file into my project with the following code:
let coastRanges = try? ModelEntity.loadModel(named: "CoastRanges")
This is a model with multiple parts ("sub-models") inside of it, just like you would expect from a modeling software.
It's a coastal scene with a general landscape, but also an ocean, rocks, etc. Of course, all of these parts need to have different materials.
In my modeling software, I did not add any materials as I wanted to add my own materials through RealityKit to have finer control over the details of my model.
I played around with the model in Reality Composer Pro before exporting it as a USDZ:
However, I have an issue.
I want to add materials I created in code to certain parts of the model. The rocks, ocean, etc. need to have completely different materials.
I believe I need to access the children of the mesh, but I can't figure it out. Every time I try to print out coastRanges.children, the result is nil.
What am I doing wrong and how can I do this?
EDIT:
I do want to add that this is not a project for visionOS. This is a project for iPadOS and Mac Catalyst.
