Skip to content

Picking bug #2942

Closed
Closed
@mramato

Description

@mramato

From the forum

Using Firefox, run the below code in Sandcastle and switch to the Console tab to see output. Mouse over the center of the plane and make small circular motions (staying over the plane). As long as you stay on the plane object, nothing should appear in the console, however, occasionally the pick fails even though you are definitely on the plane and therefore prints undefined.

This happens in IE with less frequency and does happen (rarely) in Chrome. I'm pretty sure the mouse move event is correct and the bug is somewhere in the picking code.

var viewer = new Cesium.Viewer('cesiumContainer', {
    infoBox : false,
    selectionIndicator : false
});

function createModel(url, height) {
    viewer.entities.removeAll();

    var position = Cesium.Cartesian3.fromDegrees(-123.0744619, 44.0503706, height);
    var heading = Cesium.Math.toRadians(135);
    var pitch = 0;
    var roll = 0;
    var orientation = Cesium.Transforms.headingPitchRollQuaternion(position, heading, pitch, roll);

    var entity = viewer.entities.add({
        name : url,
        position : position,
        orientation : orientation,
        model : {
            uri : url,
            minimumPixelSize : 128
        }
    });
    viewer.trackedEntity = entity;
}

createModel('../../SampleData/models/CesiumAir/Cesium_Air.bgltf', 5000.0);

var eventHandler = new Cesium.ScreenSpaceEventHandler(viewer.scene.canvas);

eventHandler.setInputAction(function(event){
    var object = viewer.scene.pick(event.endPosition);
    if(!object){
      console.log(object);
    }
}, Cesium.ScreenSpaceEventType.MOUSE_MOVE);

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions