-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
Fix camera view/flight issues when colliding with terrain #4105
Conversation
…rrain has finished loading for the area.
This seems to be completely broken. When I use the sample code from #4075, the camera rotates, but does not move. |
I forgot to mention that there is a problem with the code sample. You need to clone the camera position, not store the reference or the position will stay the same. |
OK, thanks, I fixed the example so no one makes the same mistake again. |
This is definitely better in that it recreates the view properly, the only (major) downside is that since it waits for all tiles to load, the camera can appear "stuck" for several seconds (5 in my case) while tiles are rendering. Perhaps this is unavoidable given our current loading architecture? Are we actually waiting for all tiles, or just all tile sunder the camera position? @pjcozzi since you reported this problem, I would recommend you test this out. The problem is definitely gone, but flying from the home view to a ground horizon view (which is the worse case scenario) definitely has a long delay. |
@bagnell there are JSHint warnings: https://travis-ci.org/AnalyticalGraphicsInc/cesium/builds/144003813 |
Sounds bad, even with Network throttling, I did not notice this. After I zoomed to the horizon view, I was able to pan even while the tiles (maybe just imagery?!?!?) load in. |
Did you have terrain on? From my laptop right now I have major lag. I can demo for you tomorrow. |
Yes, with terrain. @bagnell do you have a similar lag? |
It takes about 3-4 seconds before I can move the camera again when flying from the home view.
Its waiting for all tiles. The other way to do it would be to repeatedly try to pick the terrain under the camera. As soon as some terrain is picked, we can unlock the camera. The down side is that the camera could really be positioned well below the terrain so it may never get picked. |
Up to @mramato if we want to take this; otherwise, we can wait a bit for a real fix that prefetches terrain at the flight's target. |
I think the latest behavior is a good compromise until we refactor terrain and imagery loading. |
I agree, this will get it done!
|
Camera.prototype._adjustHeightForTerrain = function() { | ||
var scene = this._scene; | ||
|
||
// Should these be moved to the camera? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove this comment and submit an issue for this if you think it is worth it.
@mramato can you please test and merge when happy? |
Looks good to me, once @pjcozzi's one comment is addressed, I'll merge. |
@mramato This is ready. |
Thanks! |
NOTE: This is not ready for code review. I'm opening it to get feedback for if this is actually what we want to do. If we decide to go with it, I'll clean up the code and add tests.
Disable camera input before a flight and do not re-enable until the terrain has finished loading for the area.
Fixes #4075.