In my current three js scene, I have a ground, sky, and various objects. I want specific objects to change color to red when the mouse hovers over them, but not all objects should do this. Currently, everything I touch turns red, which is not what I want. How can I modify my code to only paint certain objects, like cars, and exclude others such as the ground, sky, or houses?
Do I need to make adjustments to this line of code?
var intersects = raycaster.intersectObjects( scene.children );
The remaining part of the code looks like this:
for ( i = 0; i < intersects.length; i++ ) {
intersects[ i ].object.material.color.set( 0xff0000 );
}
I won't include any additional code here, but it's straightforward and based on basic geometry principles along with examples from threejs.org.