Toggling on and off parts of gltf 3D file on Ceisum

**1. A concise explanation of the problem you’re experiencing. **

I have a gltf file with 6 distinct parts. I would like to be able to toggle on and off 5 of those parts from the Cesium interface. I do not know how to make this possible in Cesium.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

Here is the .gltf file with the 5 field-of-views that I would like to toggle them on and off. They are attached to the spacecraft at the other end.

Here is a part of the code that I have written

image.png

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I am trying to show fields of view of a spacecraft’s instruments and I would like users to be able to toggle on and off the different field of views from Cesium’s Interface as shown below.

4. The Cesium version you’re using, your operating system and browser.

Cesium 1.56.1, macOs, Chrome

Hey Wyckliffe,

I recently ran into this issue myself. You can’t access the nodes of the glTF from the Entity API, but you can if you’re using model primitives (an example of this is here). I’ve opened a GitHub issue here with some more details:

https://github.com/AnalyticalGraphicsInc/cesium/issues/7761

One hack you can do in the source to make this easier is to expose the model primitive from the Entity API. You can do this by adding:

entity.modelPrimitive = model

``

In this line:

https://github.com/AnalyticalGraphicsInc/cesium/blob/f90dc62275d70243ff4c6c3341648bc5db67cbbb/Source/DataSources/ModelVisualizer.js#L147

Then in your application you’ll be able to do:

entity.modelPrimitive.getNode(‘ivma’).show = false

``

Assuming your glTF has a named node called “ivma”.