How to fetch child mesh of a .obj? [Solved]

@prisoner849 thank You sir, last comment is worked

Hello sir i need your help!
i want change the color of object of material not whole object. I tried all possible codes that are above mention and that i know but i get errors i could not get required result.

object.traverse( function ( child ) {
	if ( child instanceof THREE.Object3D  ) {
		// console.log( +"test");

} );

this code work but it’s work for whole object i want to change just color of that material of that object not whole

object.getObjectByName( "Torus" ).children[0].material = new THREE.MeshBasicMaterial({color: "red"});
object.getObjectByName( "Torus" ).children[1].material = new THREE.MeshBasicMaterial({color: "green"});

i also try this code with my object name but it’s not worked
just what i need is that 'i want to change color of materials ’ of any object that also help me on other object or projects.
Very Thank full sir Please help me M beginner

Hello sir, your code in the last post is not properly formatted.


In which post brother. please can u tell me are u talking about my post?
please u can edit it again and tell me or format it correctly

Try to reproduce your problem in a small live example. That makes it easier to understand your issue.


Okay sir i can try

what if i want to apply new texture