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

Entity show not getting applied immediately #7024

Closed
lilleyse opened this issue Sep 10, 2018 · 5 comments
Closed

Entity show not getting applied immediately #7024

lilleyse opened this issue Sep 10, 2018 · 5 comments

Comments

@lilleyse
Copy link
Contributor

lilleyse commented Sep 10, 2018

Setting entity.show does not seem to get applied immediately.

pickbug

blueEllipsoid.show = false;
var picked = viewer.scene.pick(movement.position);
// entity gets picked

Sandcastle demo

Ran into this bug while working on #6934 where sampleHeight needs the ability to hide certain entities or primitives immediately before getting the height.

@lilleyse lilleyse mentioned this issue Sep 10, 2018
8 tasks
@hpinkos
Copy link
Contributor

hpinkos commented Sep 10, 2018

This seems to have reasonable behavior to me. If you disagree can you make a side-by-side comparison with how it should be using the primitive api?

@lilleyse
Copy link
Contributor Author

Primitive API demo

The primitive gets hidden and does not get picked, which is the correct behavior.

In the entity api show = false is only reflected the next frame and is not updated during the pick pass.

@hpinkos
Copy link
Contributor

hpinkos commented Sep 10, 2018

For performance, the entity primitives don't get updated until the next clock tick. I don't think this is something we'll change. In your demo, if you add the line viewer._dataSourceDisplay.update(viewer.clock.currentTime); after entity.show = false it won't pick the entity.

@mramato can chime in, but I think we should close this issue as a won't fix.

@mramato
Copy link
Contributor

mramato commented Sep 11, 2018

I mostly agree with @hpinkos here, there are plenty of things things in Cesium that don't get updated until a full frame is rendered and you can fall into a lot of issues if you call pick immediately after changing things. I would recommend scheduling a postRender callback to actually perform the pick.

That being said, drillPick works fine with entities because it just iterates all primitives and turns them off as it goes (setting the value back to the original value after it's done). I'm not sure what sampleHeight is doing, but is there a reason for it to work at the entity level instead of the primitive level?

One possible way to make entities be reflected immediately in pick (without giving scene knowledge of Entities) would be to have entities actually update in preRender instead of clock tick. Does scene.pick trigger preRender events?

@lilleyse
Copy link
Contributor Author

Ok, as long as this is expected behavior I'm fine with a workaround. Using a callback won't work with the current design but drill pick should, I was thinking about using it internally in some way.

For a little more background sampleHeight accepts a list of objects that will be excluded from picking, the usual case being to exclude the object that you are trying to position, otherwise it samples height on itself. The object could be a primitive or entity. Adding a drillSampleHeight (not final name) that returns an array of heights and picked objects might be an option too.

pick doesn't call preRender functions right now, I'd have to think more about that. I'm ok with closing this for now as won't fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants