From 81a0ca5e7ab0c41ee51808fd17c826906bf85075 Mon Sep 17 00:00:00 2001 From: linkong Date: Tue, 24 Mar 2026 12:10:52 +0800 Subject: [PATCH] fix(satellites): fix back-facing detection with proper coordinate transform --- frontend/public/earth/js/satellites.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/public/earth/js/satellites.js b/frontend/public/earth/js/satellites.js index 95a733f1..597ed25a 100644 --- a/frontend/public/earth/js/satellites.js +++ b/frontend/public/earth/js/satellites.js @@ -423,10 +423,11 @@ export function isSatelliteFrontFacing(index, camera) { const satPos = positions[index].current; if (!satPos) return true; + const worldSatPos = satPos.clone().applyMatrix4(earthObjRef.matrixWorld); const toCamera = new THREE.Vector3().subVectors(camera.position, earthObjRef.position).normalize(); - const toSat = new THREE.Vector3().subVectors(satPos, earthObjRef.position).normalize(); + const toSat = new THREE.Vector3().subVectors(worldSatPos, earthObjRef.position).normalize(); - return toCamera.dot(toSat) < 0; + return toCamera.dot(toSat) > 0; } let earthObjRef = null;