From cc6994a5858cd662f5904005bbbd9d34b712f76c Mon Sep 17 00:00:00 2001 From: ZhangXianQiang <1135831638@qq.com> Date: 星期五, 19 四月 2024 11:56:25 +0800 Subject: [PATCH] feat:添加地图label --- src/views/screen/components/screen-map-three/experience/camera.js | 16 +++++++++++----- 1 files changed, 11 insertions(+), 5 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 70f33ff..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'; @@ -15,16 +16,21 @@ // 璁剧疆閫忚鐩告満 setInstance() { - this.instance = new PerspectiveCamera(75,this.sizes.width / this.sizes.height, 0.1, 1000); - this.instance.position.set(0, 5, 2); + this.instance = new PerspectiveCamera(45,this.sizes.width / this.sizes.height, 0.001, 90000000); + this.instance.position.set(0, 45, 45); this.scene.add(this.instance); - const help = new CameraHelper(this.instance); - this.scene.add(help); + // const help = new CameraHelper(this.instance); + // this.scene.add(help); } setOrbitControls() { this.controls = new OrbitControls(this.instance, this.canvas); - this.controls.target.set(0, 0, 0); + 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