I have a small problem and I'm hoping you could help me with.
I implemented the example code provided by sketchfab and it works except for one small problem.
api.addEventListener(
'nodeMouseEnter',
function(event) {
console.log(event);
let y = event.material;
y.channels.EmitColor.factor = 1;
y.channels.EmitColor.enable = true;
y.channels.EmitColor.color = [0.5, 0.5, 0.0];
api.setMaterial(y, function() {
//console.log('highlighted ' + y.name);
});
console.log('nodeMouseEnter', event);
},
{
pick: 'slow'
}
);
function objectClicked(event){
console.log('MouseClick', event);
if(event.firstAncestorOfTypeMatrixTransform !== null && event.firstAncestorOfTypeMatrixTransform !== undefined){
currentObjectKey = event.firstAncestorOfTypeMatrixTransform.name;
selected.text(currentObjectKey+" Selected");
//toggleVisibility(currentObjectKey);
}
}
sketchfabAPIUtilityInstance.addEventListener(sketchfabAPIUtilityInstance.EVENT_CLICK, objectClicked);
I apologize for the long read and looking forward to your answer.