Back to the Shapespark home page

Hiding Object from html

I’m looking to hide a nested model completely from from the body-end.html file.
I am able to do this through changing the material on the object but I was wondering if there is a possibility to hide an object on the highest level (the AssimpFBX$_Translation)?

Because this way a few elements could be grouped and hidden together.

This part of the API isn’t yet official, but you achieve this with:

for (const node of viewer.findNodesOfType('<OBJECT TYPE NAME>')) {
  node.hide();  // node.show();
}

The nodes intended to be dynamically hidden/shown must be marked as editable using the Viewer.setNodeTypeEditable('<OBJECT TYPE NAME>') function before the scene is loaded.

Hi,
I’m trying to test the script. But I get an error “viewer.findNodesOfType is not a function”

Do you have any idea?

Could you share a link to your scene, so we could take a look? If the scene isn’t public you can send the link through forum’s PM or support@shapespark.com

Multitaskr_Capital, you need to write it like the following:

var viewer = WALK.getViewer();

viewer.setNodeTypeEditable(‘YourObject’);

for (const node of viewer.findNodesOfType(‘YourObject’)) {
node.hide();
viewer.requestFrame();
}