THREE.OrbitControls参数设置

1、控制视角(仰视角、俯视角、水平方向视角)
2、控制鼠标缩放大小
3、控制旋转速度

this.controls = new OrbitControls(this.camera, this.renderer.domElement)
this.controls.mouseButtons = {
    LEFT: THREE.MOUSE.ROTATE,
    MIDDLE: THREE.MOUSE.DOLLY,
    RIGHT: THREE.MOUSE.PAN
}

// Set to false to disable this control
//鼠标控制是否可用
this.controls.enabled = true;
 
// "target" sets the location of focus, where the object orbits around
//聚焦坐标
this.controls.target = new THREE.Vector3();
 
// How far you can dolly in and out ( PerspectiveCamera only )
//最大最小相机移动距离(景深相机)
this.controls.minDistance = 0;
this.controls.maxDistance = Infinity;
// How far you can zoom in and out ( OrthographicCamera only )
//最大最小鼠标缩放大小(正交相机)
this.controls.minZoom = 0;
this.controls.maxZoom = Infinity;
 
// How far you can orbit vertically, upper and lower limits.
// Range is 0 to Math.PI radians.
//最大仰视角和俯视角
this.controls.minPolarAngle = 0; // radians
this.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 ].
//水平方向视角限制
this.controls.minAzimuthAngle = - Infinity; // radians
this.controls.maxAzimuthAngle = Infinity; // radians
 
// Set to true to enable damping (inertia)
// If damping is enabled, you must call controls.update() in your animation loop
//惯性滑动,滑动大小默认0.25
this.controls.enableDamping = false;
this.controls.dampingFactor = 0.25;
 
// This option actually enables dollying in and out; left as "zoom" for backwards compatibility.
// Set to false to disable zooming
//滚轮是否可控制zoom,zoom速度默认1
this.controls.enableZoom = true;
this.controls.zoomSpeed = 1.0;
 
// Set to false to disable rotating
//是否可旋转,旋转速度
this.controls.enableRotate = true;
this.controls.rotateSpeed = 1.0;
 
// Set to false to disable panning
//是否可平移,默认移动速度为7px
this.controls.enablePan = true;
this.controls.keyPanSpeed = 7.0;	// pixels moved per arrow key push
 
// Set to true to automatically rotate around the target
// If auto-rotate is enabled, you must call controls.update() in your animation loop
//是否自动旋转,自动旋转速度。默认每秒30圈
this.controls.autoRotate = false;
this.controls.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
 
// Set to false to disable use of the keys
//是否能使用键盘
this.controls.enableKeys = true;
 
// The four arrow keys
//默认键盘控制上下左右的键
this.controls.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
 
// Mouse buttons
//鼠标点击按钮
this.controls.mouseButtons = { ORBIT: THREE.MOUSE.LEFT, ZOOM: THREE.MOUSE.MIDDLE, PAN: THREE.MOUSE.RIGHT };
  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

风如白话

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值