woso_javan 1 місяць тому
батько
коміт
cd49229800

+ 17 - 4
assets/module_aliens/Script/LevelAction.ts

@@ -125,6 +125,10 @@ export class LevelAction extends Component {
                 easing: 'smooth',
                 onUpdate: (target: Vec3) => {
                     this.camera.node.position = target;
+                    // 根据距离动态调整旋转限制范围
+                    const zoomFactor = Math.abs(distance) / 30;
+                    this.minYRotation = -70 * zoomFactor;
+                    this.maxYRotation = 70 * zoomFactor;
                 }
             })
             .start();
@@ -135,6 +139,7 @@ export class LevelAction extends Component {
         const touchPos = event.getLocation();
         this._touchStartPos = v3(touchPos.x, touchPos.y, 0);
         this._isDragging = true;
+        // 记录初始旋转角度
         this._originalRotation = this.camera.node.eulerAngles.clone();
     }
     
@@ -145,10 +150,18 @@ export class LevelAction extends Component {
         const deltaX = currentPos.x - this._touchStartPos.x;
         const deltaY = currentPos.y - this._touchStartPos.y;
         
-        // 计算新的旋转角度
-        const newRotation = this._originalRotation.clone();
-        newRotation.y = this._originalRotation.y - deltaX * 0.2;  // 左右滑动控制Y轴旋转
-        newRotation.x = this._originalRotation.x + deltaY * 0.2;  // 上下滑动控制X轴旋转
+        // 根据当前相机距离调整旋转灵敏度
+        const distanceFactor = Math.max(0.5, this.camera.node.position.length() / 30);
+        const sensitivity = 0.1 * distanceFactor;
+        
+        const rotationDelta = v3(
+            deltaY * sensitivity,
+            -deltaX * sensitivity,
+            0
+        );
+        
+        // 计算新旋转角度
+        const newRotation = this._originalRotation.clone().add(rotationDelta);
         
         // 添加旋转限制
         newRotation.x = Math.max(this.minXRotation, Math.min(this.maxXRotation, newRotation.x));

+ 2 - 2
profiles/v2/packages/scene.json

@@ -1214,8 +1214,8 @@
     },
     "19323c5d-5d36-438a-86ee-8288c690e5b0": {
       "position": {
-        "x": 58.95166666666667,
-        "y": 125.49833333333333,
+        "x": 67.10166666666666,
+        "y": 142.84833333333333,
         "z": 5000
       },
       "rotation": {