Unable to select feature on gltf with multiple meshes

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

I am generating a gltf model with multiple(two) meshes. I add batchid and an accessor with scalar type. However when I try to pick the feature, the returning feature contains both of the meshes.

Is there way to check if the batchid attribute assignment is wrong. or is it related with the gltf having multiple meshes?

Thank you

5.b3dm (25.5 KB)

5.gltf (32.1 KB)

tileset_b.json (1.31 KB)

Can you post the code you’re using to test this? Are you using 3d-tiles-tools to generate the b3dm from the gltf, or something else?

If I remember correctly, I don’t think 3d-tiles-tools will pick up any metadata from the glTF into the produced B3dm.

Hi Omar,

Thank you for the reply. This is the snippet i use for testing. You can find the complete test page in the attachment. I am generating b3dm myself. I am adding custom attribute for _BATCHID and I think there is a problem with the way the gltf exported. Gltf consists of multiple nodes and while i can select single nodes in any gltf viewer, this is not the case for b3dm. In b3dm i can see two features with one having two geometries and the other one is empty. Either the way i am adding BATCHID has an error or I need the gltf file exported in a single node. I am not sure how to validate a b3dm file.

var clickHandler = viewer.screenSpaceEventHandler.getInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
viewer.screenSpaceEventHandler.setInputAction(function onLeftClick(movement) {

        // If a feature was previously selected, undo the highlight
        if (Cesium.defined(feature)) {
            try {
              feature.color = originalColor;
            }
            catch (ex) { }
            feature = undefined;
        }

        // Pick a new feature
        var pickedFeature = viewer.scene.pick(movement.position);

        if (!Cesium.defined(pickedFeature)) {
            clickHandler(movement);
            return;
        }

        // Select the feature if it's not already selected
        if (feature === pickedFeature) {
            return;
        }

        feature = pickedFeature;
     
        // Save the selected feature's original color
        if (pickedFeature === highlighted.feature) {
            Cesium.Color.clone(highlighted.originalColor,selected.originalColor);

        } else {
            Cesium.Color.clone(pickedFeature.color,selected.originalColor);
        }

        // Highlight newly selected feature
        pickedFeature.color = Cesium.Color.LIME;

        // Set feature infobox description
        if (pickedFeature == undefined || pickedFeature.getProperty == undefined) {
            return;
    }
        var featureName = pickedFeature.getProperty('name');

    }, Cesium.ScreenSpaceEventType.LEFT_CLICK);

``

index.html (3.74 KB)