Reset inertial input based camera movement with flyTo

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

I swipe the globe, causing it to rotate and slow down with inertia.

While it is still rotating from the swipe, I click on a button causing a camera.flyTo to a position on the map.

The problem I am seeing is that after the flyTo is complete, the globe continues to move in the inertial direction it was before the flyTo.

I am looking for a way to reset the camera movement caused by input, so the globe does not continue to move after the camera flight is complete.

2. A minimal code example. If you’ve found a bug, this helps us reproduce and repair it.

I made the following codesandbox illustrating the issue: https://codesandbox.io/s/focused-hill-otlr5

Click, drag and release the globe in any direction to give it some intertial movement.

200ms after releasing the mouse, the code does a camera.flyTo to moscow.

You should see intertial movement after the camera flyTo has occurred.

3. Context. Why do you need to do this? We might know a better way to accomplish your goal.

I have a globe filled with markers. When you click on a marker, I want to fly to that position. Currently after the flyto is done, I sometimes see leftover inertial movement from the initial .

4. The Cesium version you’re using, your operating system and browser.

Demo is running on Cesium 1.64. My OS is OSX Catalina on latest Chrome 78.

I have figured out a hack to solve this issue by recreating the ScreenSpaceCameraController before the camera.flyTo. As you can see in the following codesandbox, when swiping the globe, the camera stops right after the flyTo: https://codesandbox.io/s/relaxed-margulis-mlff6

I would love to figure out a way to do this without resorting to private apis though… (Or should I report this as a bug to the Cesium Github?)

Hey Jonathan,

Thanks for bringing this up. I think this might be a good idea to open a GitHub issue for. I think your code example does a good job showing the issue. There’s no way to reset the camera’s velocity from the public API, and I wonder if it’s best to just automatically do this when a flyTo happens.

Thanks for the feedback, Omar! I have opened an issue here: https://github.com/AnalyticalGraphicsInc/cesium/issues/8451