I imported this ship model as a glTF Model and have implemented the model coloring feature from the sandcastle showcases. While the whole ship is able to change colors, I want to change the color of the gun of the ship specifically. I would also like to have the gun be a separate clickable entity. I’m not exactly sure how to achieve this with CesiumJS. Thanks in advance!
Individual nodes in a glTF model are pickable. However, the glTF model must be created with the primitive API. This sandcastle demo showcases how this can be done.
Note that when you use your mouse to select the propeller, we see the following output in the console.
node: Prop__2_. mesh: Prop
While individual nodes in a glTF model are pickable, you cannot change the color of individual nodes in a glTF model. For more information on changing node colors, check out the following issue.
Your desired functionality is possible with 3D Tiles. Unfortunately, our model tiler does not generate 3D Tilesets that have pickable features. Thus, I can’t really recommend using Cesium ion for this use case.
Sadly there is not a great workaround for you at the moment. I could not think of a quick and easy solution. You may be able to achieve your desired functionality using custom shaders.
However, we are still developing this technology and I am not 100% confident that it can be used for this purpose. @sean_lilley posted some thoughts and suggestions on the following issue.
I recommend checking this out. Let me know if you have any other questions or comments!