From 496f3a16fa0fddd23af01fe6cb4d0709a6ebc8d9 Mon Sep 17 00:00:00 2001
From: ZhangXianQiang <1135831638@qq.com>
Date: 星期四, 18 四月 2024 16:37:10 +0800
Subject: [PATCH] feat:鼠标移入效果
---
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