I have a cube that I want to change the colour of when I hover over it. This works when I just use one texture, but now I want to advance this to using a texture array, one texture per face.
if ( intersects.length > 0 )
{
// if the closest object intersected is not the currently stored intersection object
   if ( intersects[ 0 ].object != INTERSECTED ) 
    {
      // restore previous intersection object (if it exists) to its original color
        if ( INTERSECTED ) 
            INTERSECTED.material.color.setHex( INTERSECTED.currentHex );
            // store reference to closest object as current intersection object
            INTERSECTED = intersects[ 0 ].object;
            // store color of closest object (for later restoration)
            INTERSECTED.currentHex = INTERSECTED.material.color.getHex();
            // set a new color for closest object
            INTERSECTED.material.color.setHex( 0x118D08 );
    }
When I do this the color change on hover doesn't work and I get these errors:
Uncaught TypeError: Cannot read property 'setHex' of undefined [repeated 13 times]
Uncaught TypeError: Cannot read property 'getHex' of undefined
The cube is textured the way I want it to be, so the error is not with that. I think it has something to do with MeshFaceMaterial not having a color parameter or something. Could anyone tell me if what I am trying to do is possible or any ideas where I'm going wrong?
 
     
     
    