如何限制OrbitControl? [英] How do I put limits on OrbitControl?

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

问题描述

是否可以对 OrbitControls.js 设置限制?想象一下,我要在地面上创建东西,我不希望相机放到地面下,知道我的意思吗?!放大和缩小也一样。有没有一种方法可以设置一些变量来限制该变量,因为我不想让相机靠近或太远?

Is there a way to put limits on the OrbitControls.js? Imagine I'm creating something above the ground, I wouldn't like the camera to go below the ground, know what I mean?! The same things goes for zoom in and zoom out. Is there a way to set some variables to limit that because I don't want the camera getting to close or too far away?

推荐答案

OrbitControls来源

放大/缩小

this.minDistance = 0;
this.maxDistance = Infinity;

停止旋转的位置:

this.minPolarAngle = 0; // radians
this.maxPolarAngle = Math.PI; // radians

不要跌倒地面

controls.maxPolarAngle = Math.PI/2; 

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

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