From 9506648877425e2ab94084d280515fa98a429d2b Mon Sep 17 00:00:00 2001 From: TermiNexus Date: Sat, 17 Oct 2026 16:29:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(lib):=20=E4=BD=8D=E7=BD=AE=E6=8E=A2?= =?UTF-8?q?=E6=B5=8B=E5=A2=9E=E5=8A=A0=E7=9F=A9=E9=98=B5=E5=BC=8F=E5=85=9C?= =?UTF-8?q?=E5=BA=95=EF=BC=88[12],[13],[14]=20=E5=B9=B3=E7=A7=BB=E5=88=86?= =?UTF-8?q?=E9=87=8F=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 旧版位置来自物理组件的世界变换矩阵(K$ 实例,非普通向量),新版字段平移后无法靠名字命中 - 兜底 2:遍历组件找长度 >=15 的矩阵对象,取 [12]/[13]/[14] 作为平移(引擎惯用布局) --- .../play/static/js/unpacked/hornet_bundle.js | 24 ++++++++++++++++++- 3dtank_bundle.js | 24 ++++++++++++++++++- tools/hornet_lib.js | 24 ++++++++++++++++++- 3 files changed, 69 insertions(+), 3 deletions(-) diff --git a/3dtank.com/play/static/js/unpacked/hornet_bundle.js b/3dtank.com/play/static/js/unpacked/hornet_bundle.js index d2bb6a1..87ef1c7 100644 --- a/3dtank.com/play/static/js/unpacked/hornet_bundle.js +++ b/3dtank.com/play/static/js/unpacked/hornet_bundle.js @@ -276,7 +276,7 @@ return { x: Comp[Key].f20_1, y: Comp[Key].g20_1, z: Comp[Key].h20_1 }; } } - // 兜底:遍历坦克全部组件,找任意"带 O$ 向量"的组件(位置向量通常会每帧更新,取第一个数值合理的) + // 兜底 1:遍历坦克全部组件,找任意"带 O$ 向量"的组件 var Found = null; try { tank.qz1_1.s2a_1.forEach(function (valueList) { @@ -294,6 +294,28 @@ } }); } catch (e) {} + if (Found) return Found; + + // 兜底 2:矩阵式位置 —— 引擎的世界矩阵通常是长度 ≥16 的数组,[12],[13],[14] 是平移分量 + try { + tank.qz1_1.s2a_1.forEach(function (valueList) { + if (Found) return; + var comp = (valueList && typeof valueList.g1 === 'function') ? valueList.g1(0) : valueList; + if (!comp) return; + for (var K in comp) { + var M = comp[K]; + if (M && typeof M === 'object' && typeof M.length === 'number' && M.length >= 15) { + var X = M[12], Y = M[13], Z = M[14]; + if (typeof X === 'number' && typeof Y === 'number' && typeof Z === 'number' && + Math.abs(X) < 1e6 && Math.abs(Y) < 1e6 && Math.abs(Z) < 1e6 && + (X !== 0 || Y !== 0 || Z !== 0)) { + Found = { x: X, y: Y, z: Z }; + return; + } + } + } + }); + } catch (e) {} return Found; } diff --git a/3dtank_bundle.js b/3dtank_bundle.js index d2bb6a1..87ef1c7 100644 --- a/3dtank_bundle.js +++ b/3dtank_bundle.js @@ -276,7 +276,7 @@ return { x: Comp[Key].f20_1, y: Comp[Key].g20_1, z: Comp[Key].h20_1 }; } } - // 兜底:遍历坦克全部组件,找任意"带 O$ 向量"的组件(位置向量通常会每帧更新,取第一个数值合理的) + // 兜底 1:遍历坦克全部组件,找任意"带 O$ 向量"的组件 var Found = null; try { tank.qz1_1.s2a_1.forEach(function (valueList) { @@ -294,6 +294,28 @@ } }); } catch (e) {} + if (Found) return Found; + + // 兜底 2:矩阵式位置 —— 引擎的世界矩阵通常是长度 ≥16 的数组,[12],[13],[14] 是平移分量 + try { + tank.qz1_1.s2a_1.forEach(function (valueList) { + if (Found) return; + var comp = (valueList && typeof valueList.g1 === 'function') ? valueList.g1(0) : valueList; + if (!comp) return; + for (var K in comp) { + var M = comp[K]; + if (M && typeof M === 'object' && typeof M.length === 'number' && M.length >= 15) { + var X = M[12], Y = M[13], Z = M[14]; + if (typeof X === 'number' && typeof Y === 'number' && typeof Z === 'number' && + Math.abs(X) < 1e6 && Math.abs(Y) < 1e6 && Math.abs(Z) < 1e6 && + (X !== 0 || Y !== 0 || Z !== 0)) { + Found = { x: X, y: Y, z: Z }; + return; + } + } + } + }); + } catch (e) {} return Found; } diff --git a/tools/hornet_lib.js b/tools/hornet_lib.js index 40b04da..fa5ba22 100644 --- a/tools/hornet_lib.js +++ b/tools/hornet_lib.js @@ -61,7 +61,7 @@ return { x: Comp[Key].f20_1, y: Comp[Key].g20_1, z: Comp[Key].h20_1 }; } } - // 兜底:遍历坦克全部组件,找任意"带 O$ 向量"的组件(位置向量通常会每帧更新,取第一个数值合理的) + // 兜底 1:遍历坦克全部组件,找任意"带 O$ 向量"的组件 var Found = null; try { tank.qz1_1.s2a_1.forEach(function (valueList) { @@ -79,6 +79,28 @@ } }); } catch (e) {} + if (Found) return Found; + + // 兜底 2:矩阵式位置 —— 引擎的世界矩阵通常是长度 ≥16 的数组,[12],[13],[14] 是平移分量 + try { + tank.qz1_1.s2a_1.forEach(function (valueList) { + if (Found) return; + var comp = (valueList && typeof valueList.g1 === 'function') ? valueList.g1(0) : valueList; + if (!comp) return; + for (var K in comp) { + var M = comp[K]; + if (M && typeof M === 'object' && typeof M.length === 'number' && M.length >= 15) { + var X = M[12], Y = M[13], Z = M[14]; + if (typeof X === 'number' && typeof Y === 'number' && typeof Z === 'number' && + Math.abs(X) < 1e6 && Math.abs(Y) < 1e6 && Math.abs(Z) < 1e6 && + (X !== 0 || Y !== 0 || Z !== 0)) { + Found = { x: X, y: Y, z: Z }; + return; + } + } + } + }); + } catch (e) {} return Found; }