woso_javan 1 månad sedan
förälder
incheckning
4a89cd4704
1 ändrade filer med 5 tillägg och 3 borttagningar
  1. 5 3
      assets/module_aliens/Script/LevelAction.ts

+ 5 - 3
assets/module_aliens/Script/LevelAction.ts

@@ -165,15 +165,15 @@ export class LevelAction extends Component {
         if(this._isZooming) return;
 
         this._isZooming = true;
-        const currentPos = this.camera.node.position.clone();
+        const currentPos = this.camera.node.worldPosition.clone();
         const forward = this.camera.node.forward.negative();
         const targetPos = currentPos.add(forward.multiplyScalar(distance));
         
-        tween(this.camera.node.position)
+        tween(this.camera.node.worldPosition)
             .to(ANIMATION_DURATION, targetPos, {
                 easing: 'smooth',
                 onUpdate: (target: Vec3) => {
-                    this.camera.node.position = target;
+                    this.camera.node.worldPosition = target;
                     // 根据镜头距离动态调整旋转限制
                     this.adjustRotationLimits();
                     this._isZooming = false; 
@@ -245,6 +245,8 @@ export class LevelAction extends Component {
 
     /***************************触摸事件**********************************/
     private _onTouchStart(event: EventTouch) {
+        if(this._isZooming)return;
+        
         const touchPos = event.getLocation();
         this._touchStartPos = v3(touchPos.x, touchPos.y, 0);
         this._isDragging = true;