Inertia in OrbitControls from ThreeJS
javascript, three.js
Solution
Here is a very simple way to add inertia in OrbitControls.js:
At the end of the update function (Lines 271-272 currently) you will see the following two variables set to zero:
thetaDelta = 0;
phiDelta = 0;
Change this so that instead of immediately going to zero, they just get smaller over time:
thetaDelta /= 1.5;
phiDelta /= 1.5;
That's it!
Problem
I am using THREE.OrbitControls for rotating my objects. However I would like to add some innertia for camera rotation (if someone stops moving mouse, camera stops after a while). How can I accomplish that?