So I have a object loaded with OBJLoader and now I want to change the color of a part of it. Its a avatar with 5 parts, the head, torso, arms, and legs.
Suppose I want to change the color of the torso, how do I do that?
- Add names / labels to meshes (eg. in Blender.)
- After loading the mesh, in the callback, traverse through the children (probably the east with
Object3D.traverse((mesh) => ...)). - Each child object has a
nameproperty. Find the corresponding one and update it’smaterialprop. (Mind, if your model is animated and you change it’s material, be sure to setskinning = truein the new material.)
1 Like