本文介绍了带阻尼的 OrbitControls的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有没有办法、插件或想法让 THREE.js OrbitControls
在旋转时产生惯性效果?
Is there a way, plugin or idea to give the THREE.js OrbitControls
the effect of inertia when spinning?
我想旋转一个带有一些阻尼的世界球体,如下所示:http://stemkoski.github.io/Three.js/Polyhedra.html
I would like to spin a world-sphere with some damping like this:http://stemkoski.github.io/Three.js/Polyhedra.html
原始 OrbitControls
行为如下所示:http://threejs.org/examples/#misc_controls_orbit
The original OrbitControls
behaviour looks like this:http://threejs.org/examples/#misc_controls_orbit
推荐答案
OrbitControls 现在支持阻尼/惯性.
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
three.js r.108
这篇关于带阻尼的 OrbitControls的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!