D
D
Dmitry2016-02-24 23:25:46
WebGL
Dmitry, 2016-02-24 23:25:46

Threejs - how to change hover material texture in json model?

that is, I want that when hovering over the link: $(".link").mouseover(function() {
the attribute was assigned to the json model: ( instead of textura-1.jpg -> textura-2.jpg )
{
"DbgIndex" : 2,
"DbgName" : "Material #5428",
"colorDiffuse" : [0.5880, 0.5880, 0.5880],
"colorAmbient" : [0.5880, 0.5880, 0.5880],
"colorSpecular" : [0.9000, 0.9000, 0.9000],
" transparency" : 1.0,
"specularCoef" : 10.0,
"mapDiffuse" : "textura-1.jpg",
"vertexColors" : false
},

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Khangeldy Ilebaev, 2016-03-06
@mahabatuly

Roughly so it is possible to ride

//...
mesh.name = 'myname';
//...
var el = document.getElementById('link1');
el.on('click', function() {
    scene.getObjectByName('myname').material.map = newTexture;
    renderer.render(scene, camera);
}
//....

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question