Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OrbitControls with damping

Is there a way, plugin or idea to give the THREE.js OrbitControls the effect of inertia when spinning?

I would like to spin a world-sphere with some damping like this: http://stemkoski.github.io/Three.js/Polyhedra.html

The original OrbitControls behaviour looks like this: http://threejs.org/examples/#misc_controls_orbit

like image 704
Marcel Ennix Avatar asked Aug 17 '15 21:08

Marcel Ennix


1 Answers

OrbitControls now supports damping / inertia.

controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.enableDamping = true;
controls.dampingFactor = 0.05;

Then in your animation loop add

controls.update(); // required if controls.enableDamping = true, or if controls.autoRotate = true

three.js r.108

like image 69
WestLangley Avatar answered Oct 12 '22 05:10

WestLangley