Hiding nodes upon load

Hello group,
I have this simple configurator that I am working on and for the most part, aside from the styling, I have the show/hide functionality working as expected. The problem I am running into is I cannot hide my model’s accessory nodes upon loading of the viewer.

Below is a code pen and the javascript I was attempting to utilize. Any help would be appreciated.

https://codepen.io/aestrada_salsbury/pen/KKxoJwX

client.addEventListener(‘viewerready’, function() {
var nodeId = ‘234’;

client.getApi(‘v1’).getNodeMap(function(err, nodes) {
if (err) { console.error(err); return; }
var node = nodes[nodeId];
if (node) {
node.visible = false;
}
});
});
}

The recent Sketchfab API Livestream covers this exact scenario. Here’s a code example that hides a node upon loading a scene: https://codepen.io/klaasnienhuis/pen/OJEOapR

The livestream is about the length of a soccer match but way more exciting: Introduction to the Sketchfab Viewer API with Klaas Nienhuis - YouTube

Thank you for the resources Mr. Nienhuis, this worked perfectly! Very good information in the livestream. Appreciate the assist!

1 Like