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
name
property. Find the corresponding one and update it’smaterial
prop. (Mind, if your model is animated and you change it’s material, be sure to setskinning = true
in the new material.)
1 Like