From b71940f4922e80d16f6afd0bfcdcff021ce0d67e Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 13 Apr 2026 15:23:53 +0000 Subject: [PATCH] Fix lookAt camera y=false using orbit-center Y instead of camera world Y For ArcRotateCamera, getAbsolutePosition() returns the camera's world position (orbit centre + orbital offset), not the orbit centre itself. Using that Y value as the new setTarget() height displaced the orbit centre upward by the full orbital offset, making the camera tilt down instead of staying level. Fix: use mesh1.target?.y (the actual orbit-centre Y for ArcRotateCamera, and the current look-at Y for FreeCamera) so that only the X/Z of the orbit centre changes, giving a pure horizontal yaw with no pitch change. https://claude.ai/code/session_012ASzHmpUWv39A2j5hiFzyc --- api/transform.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/api/transform.js b/api/transform.js index 11c52b39b..dd5a1bc76 100644 --- a/api/transform.js +++ b/api/transform.js @@ -545,7 +545,7 @@ export const flockTransform = { const tgtPos = ( mesh2.getAbsolutePosition?.() ?? mesh2.absolutePosition ).clone(); - if (!useY) tgtPos.y = camPos.y; + if (!useY) tgtPos.y = mesh1.target?.y ?? camPos.y; mesh1.setTarget(tgtPos); await new Promise((resolve) => { const cb = () => {