Changing texture on cloned object


I have a little problem with texture changing. I clone a OBJ loaded object and i changed his texture. But all cloned object still have the same texture.
Here my code:

var loader = new THREE.OBJLoader( manager );
loader.load( 'models/L200-OBJ/L200-OBJ.obj', function ( object ) {

for(var i=0; i<5; i++)
	for(var j=0; j<5; j++)
		var car = object.clone();
		for(var c in car.children)
			if ( car.children[c] instanceof THREE.Mesh ) {
				var t = Math.round(Math.random()*(textures_car.length-1));
				car.children[c] = textures_car[t];
				car.children[c] = true;
				car.children[c].material.needsUpdate = true;
		car.position.x = -200+j*100;
		car.position.z = 200+i*100;
		car.position.y = -100;
		car.rotation.y = Math.PI;
		scene.add( car );

Thanks you for your help!

I put online the result:

Since the material is shared between all cloned instances, you have to ensure that all new objects have their own material instance. So try to clone the material first an then set the individual material properties.

Thanks you Mugen87 :slight_smile:

I had this line and it works:

car.children[c].material = object.children[c].material.clone();