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