How to pick model or node using name in Cesium

Hi,

I’m trying to achieve the functionality to change the property of the model using model name. (e.g. changing the color of the loaded 3D model). I can achieve this functionality using mouse picking. The code is detailed below.

var handler = new Cesium.ScreenSpaceEventHandler(scene.canvas);
handler.setInputAction(
    function (movement) {
        var pick = scene.pick(movement.endPosition);
        if (Cesium.defined(pick) && Cesium.defined(pick.node) && Cesium.defined(pick.mesh)) {
            console.log('node: ' + pick.node.name + '. mesh: ' + pick.mesh.name);
        }
    },
    Cesium.ScreenSpaceEventType.MOUSE_MOVE
);

From this I can get the materials from “pick.mesh._materials” But I wanted to do the same by sending the model name.

I’ve found the API to get the node or model from the name

e.g. model.getNode(‘model_name’) will give the mesh or node. But I could not found the materials inside.

Is there any other API to get the mesh by passing model_name or model_id ?

Advice/help is greatly appreciated!

Check out ModelMaterial.

Note that this might not have all the features you want yet. See #1841 and #2387.

Patrick

Thank you so much for the immediate response!

Let me give a try on the solution.

Regards,

Premkumar