Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Picking bug #2942

Closed
mramato opened this issue Aug 17, 2015 · 5 comments
Closed

Picking bug #2942

mramato opened this issue Aug 17, 2015 · 5 comments

Comments

@mramato
Copy link
Contributor

mramato commented Aug 17, 2015

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);
@pjcozzi
Copy link
Contributor

pjcozzi commented Sep 9, 2015

#3010 does not fix this.

@mramato
Copy link
Contributor Author

mramato commented Oct 14, 2015

I can no longer reproduce this. Maybe we accidentally fixed it. Can someone confirm this and close if it's fixed. Thanks.

@pjcozzi
Copy link
Contributor

pjcozzi commented Oct 14, 2015

I can still reproduce this in Firefox 41 on Mac in master.

@mramato
Copy link
Contributor Author

mramato commented Oct 14, 2015

Okay, maybe it's not all machines, I'll have to check my desktop (which is where I originally encountered the problem). Thanks.

@pjcozzi
Copy link
Contributor

pjcozzi commented Jun 14, 2017

Updated code example:

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, new Cesium.HeadingPitchRoll(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.glb', 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);

I can't reproduce this in Firefox 53 or Chrome 59 on Mac.

@pjcozzi pjcozzi closed this as completed Jun 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants