From 35ddaca1fe74191a9861f42b1d6d5f1ed93651a5 Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期三, 17 四月 2024 15:33:47 +0800 Subject: [PATCH] feat:添加角度限制 --- src/views/screen/components/screen-map-three/experience/camera.js | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/src/views/screen/components/screen-map-three/experience/camera.js b/src/views/screen/components/screen-map-three/experience/camera.js index 792beeb..8a541f2 100644 --- a/src/views/screen/components/screen-map-three/experience/camera.js +++ b/src/views/screen/components/screen-map-three/experience/camera.js @@ -1,3 +1,4 @@ +import {MathUtils} from 'three'; import { PerspectiveCamera, CameraHelper } from 'three'; import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls'; @@ -26,6 +27,10 @@ this.controls = new OrbitControls(this.instance, this.canvas); this.controls.target.set(0, 0, 5); this.controls.enableDamping = true; + this.controls.minDistance = 20; + this.controls.maxDistance = 80; + this.controls.maxPolarAngle = MathUtils.degToRad(80); + // this.controls.maxPolarAngle = (-Math.PI / 2); } resize() { -- Gitblit v1.8.0