I'm doing simple three js scene with ground, sky, and some objects. Some objects should be colored red when mouse over, but not all. I got it work in way it colors everything red I touch but how do I prevent that, and just paint the objects i want to paint? For example not a ground, sky, or houses, but only the cars.
Is it something I should do for this line?
var intersects = raycaster.intersectObjects( scene.children );
The rest of it is like:
for ( i = 0; i < intersects.length; i++ ) {
intersects[ i ].object.material.color.set( 0xff0000 );
}
I'm not putting any more code in here but it's so simple that i bet you understand what i'm doing. basic geometry stuff and raycaster made based on examples from threejs.org.
Here is the pattern to follow if you want to raycast against a subset of the scene objects:
three.js r.83