From 7415626395d6d5f8f2a36751f47ffd5158b6fb80 Mon Sep 17 00:00:00 2001 From: panw Date: Thu, 19 Mar 2026 10:18:47 +0800 Subject: [PATCH] =?UTF-8?q?fix(SMoveSystem):=20=E4=BF=AE=E5=A4=8D=E7=BA=BF?= =?UTF-8?q?=E6=80=A7=E7=A7=BB=E5=8A=A8=E7=9A=84=E8=B5=B7=E5=A7=8B=E4=B8=8E?= =?UTF-8?q?=E7=9B=AE=E6=A0=87=E4=BD=8D=E7=BD=AE=E8=AE=A1=E7=AE=97=E9=94=99?= =?UTF-8?q?=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修正线性移动类型中位置调整逻辑,现在正确基于 startPos 和 targetPos 应用 atk_x 和 atk_y 偏移量,而非错误地使用 node.position。同时确保水平移动开关能正确对齐起始与目标的 Y 轴坐标。 --- assets/script/game/skill/SMoveSystem.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/assets/script/game/skill/SMoveSystem.ts b/assets/script/game/skill/SMoveSystem.ts index dcf3ba2b..571abba0 100644 --- a/assets/script/game/skill/SMoveSystem.ts +++ b/assets/script/game/skill/SMoveSystem.ts @@ -65,18 +65,24 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate switch(moveComp.runType) { case RType.linear: // linear类型:根据atk_x和atk_y调整位置 - const linearPos = v3( - node.position.x + moveComp.atk_x, - node.position.y + moveComp.atk_y, - node.position.z + const adjustedStartPos = v3( + moveComp.startPos.x + moveComp.atk_x, + moveComp.startPos.y + moveComp.atk_y, + moveComp.startPos.z + ); + const adjustedTargetPos = v3( + moveComp.targetPos.x + moveComp.atk_x, + moveComp.targetPos.y + moveComp.atk_y, + moveComp.targetPos.z ); // 如果开启水平移动开关,强制目标Y等于起点Y if (moveComp.isHorizontal) { - moveComp.targetPos.y = linearPos.y; + adjustedTargetPos.y = adjustedStartPos.y; } - - moveComp.rePos(linearPos); + moveComp.startPos.set(adjustedStartPos); + moveComp.targetPos.set(adjustedTargetPos); + node.setPosition(adjustedStartPos); // 设置旋转角度 const direction = new Vec3(); @@ -96,7 +102,9 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate // 固定结束位置 node.setPosition(moveComp.targetPos.x > 360 ? 300 : moveComp.targetPos.x, node.position.y, 0); break; - + case RType.bezier: + // + return default: // 其他类型(包括bezier):根据atk_x和atk_y调整起始位置 if (moveComp.atk_x !== 0 || moveComp.atk_y !== 0) {