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 ); }