I have an Entity, loaded from a USDZ file. I want to change the color of one of its modelEntities. I'm isolating that part of the model like this:
let towelModel = towel.children[0].children[0] as? ModelEntity
And that produces the correct ModelEntity:
'Towel_Plane_008' : ModelEntity
Transform
SynchronizationComponent
ModelComponent
I've tried changing its color three different ways:
var material = SimpleMaterial()
material.color = .init(tint: .white)
towelModel.model?.materials[0] = material
var material = SimpleMaterial()
material.color = .init(tint: .white)
towelModel.model?.materials = [material]
var material = SimpleMaterial()
material.color = .init(tint: .white)
var comp: ModelComponent = towelModel.components[ModelComponent.self]!
comp.materials = [material]
towelModel.components.set(comp)
None of which work. What is the correct way to do this?