限制OrbitControls水平旋转 [英] Limit OrbitControls horizontal rotation

查看:1609
本文介绍了限制OrbitControls水平旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在OrbitControls上限制水平旋转?

How can I limit horizontal rotation on OrbitControls?

在代码中我可以看到可以使用<$垂直限制它c $ c> minPolarAngle 和 maxPolarAngle 。但我无法找到一种方法来横向限制它。

Inside the code I could see that it's possible to limit it vertically using minPolarAngle and maxPolarAngle. But I couldn't find a way to limit it horizontally.

-

编辑:我知道它OrbitControls不会旋转网格而是相机。我只想要一个解决方案来对相机设置水平限制。

I know that it OrbitControls doesn't rotate the Mesh but the Camera. I just want a solution to put horizontal limits on the camera.

推荐答案

编辑:能够水平和垂直限制相机移动现在是 的一项功能OrbitControls

The ability to constrain camera movement both horizontally and vertically is now a feature of OrbitControls.

// How far you can orbit vertically, upper and lower limits.
// Range is 0 to Math.PI radians.
controls.minPolarAngle = 0; // radians
controls.maxPolarAngle = Math.PI; // radians

// How far you can orbit horizontally, upper and lower limits.
// If set, must be a sub-interval of the interval [ - Math.PI, Math.PI ].
controls.minAzimuthAngle = - Infinity; // radians
controls.maxAzimuthAngle = Infinity; // radians

three.js r.71

three.js r.71

这篇关于限制OrbitControls水平旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆