Programmatically stop inertia?

When a user spins the globe, the globe continues to move after mouseup, creating an “inertia” effect. Is there a way to stop or cancel that inertial movement?

Hi @matthias-ccri, you can disable inertia by setting ScreenSpaceCameraController.inertiaSpin and ScreenSpaceCameraController.inertiaTranslate to 0.

viewer.scene.screenSpaceCameraController.inertiaSpin = 0.0;
viewer.scene.screenSpaceCameraController.inertiaTranslate = 0.0;

Thanks @Gabby_Getz, you said that will disable inertia but will it stop an in-progress inertial movement?

Our use case is that we have a button that flies to a certain place on the earth. When a user spins the globe and the globe keeps spinning because of inertia, when they click the button, the camera flies to that place, but inertia keeps moving the globe.

I’d expect something like screenSpaceCameraController.cancelInertia() or something

Ah I see. Typically that’s not how we’ve seen the controller being used, but I do think it will work.

1 Like