From 42c0a25e20aa93a7dc11a33467ef27006d57214e Mon Sep 17 00:00:00 2001 From: panFD Date: Sat, 15 Aug 2026 16:23:12 +0800 Subject: [PATCH] =?UTF-8?q?fix(skill):=20=E4=BC=98=E5=8C=96=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E7=B3=BB=E7=BB=9F=EF=BC=9A=E7=AE=80=E5=8C=96=E9=A3=9E?= =?UTF-8?q?=E8=A1=8C=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 重构移动系统 调整技能移动的朝向和目标点计算逻辑,改为仅按水平朝向飞行,移除基于缩放的固定水平移动,去掉高度差计算,简化目标点直接使用起始点高度。 --- assets/script/game/skill/SMoveSystem.ts | 34 ++++++------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/assets/script/game/skill/SMoveSystem.ts b/assets/script/game/skill/SMoveSystem.ts index 81495f35..b82683a3 100644 --- a/assets/script/game/skill/SMoveSystem.ts +++ b/assets/script/game/skill/SMoveSystem.ts @@ -74,42 +74,24 @@ export class SMoveSystem extends ecs.ComblockSystem implements ecs.ISystemUpdate moveComp.startPos.z ); - const originTargetPos = v3( - moveComp.targetPos.x, - moveComp.targetPos.y, - moveComp.targetPos.z - ); - - const direction = new Vec3(); - Vec3.subtract(direction, originTargetPos, adjustedStartPos); + // 水平向前飞行:方向仅由朝向(scale)决定,忽略目标点的高度差 + const forwardX = moveComp.scale > 0 ? 1 : -1; let adjustedTargetPos: Vec3; if (moveComp.distance > 0) { - // 距离模式:沿起始指向目标的方向飞行固定距离 - if (direction.length() < 0.01) { - // 起终点重合时退化为按朝向水平飞行 - direction.set(moveComp.scale > 0 ? 1 : -1, 0, 0); - } - direction.normalize(); + // 距离模式:沿水平方向飞行固定距离 adjustedTargetPos = v3( - adjustedStartPos.x + direction.x * moveComp.distance, - adjustedStartPos.y + direction.y * moveComp.distance, - originTargetPos.z + adjustedStartPos.x + forwardX * moveComp.distance, + adjustedStartPos.y, + adjustedStartPos.z ); } else { // 延长终止点,统一消亡点的x坐标为 +-500 const targetX = moveComp.scale > 0 ? 500 : -500; - let targetY = originTargetPos.y; - - if (Math.abs(direction.x) > 0.01) { - const slope = direction.y / direction.x; - targetY = adjustedStartPos.y + slope * (targetX - adjustedStartPos.x); - } - adjustedTargetPos = v3( targetX, - targetY, - originTargetPos.z + adjustedStartPos.y, + adjustedStartPos.z ); }