Three.js OrbitControls如何在平移时逐渐平滑地停止,而不是立即停止?

Three.js OrbitControls how to stop gradually and smoothly, instead of instantly when panning?

当我在屏幕上平移场景时,如何设置OrbitControls让场景逐渐停止,而不是像this website那样立即停止?

这是我的代码。

controls = new THREE.OrbitControls( camera, renderer.domElement );
controls.mouseButtons = {
    ORBIT: THREE.MOUSE.RIGHT,
    ZOOM: THREE.MOUSE.MIDDLE,
    PAN: THREE.MOUSE.LEFT
};
controls.enableDamping = true;
controls.dampingFactor = 0.25;
controls.screenSpacePanning = false;

const direction = new THREE.Vector3();
camera.getWorldDirection(direction);
camera.getWorldPosition(controls.target);
controls.target.addScaledVector(direction, 50);

谢谢!!

使用您的代码时,我可以在计算机上看到阻尼,请参阅 https://jsfiddle.net/p2kgvxoc/。您可能希望将 OrbitControls.dampingFactor 设置为较低的值,以使阻尼效果更加明显。还要确保使用活动渲染循环。