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

查看:25
本文介绍了如何对 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天全站免登陆