// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Face a target while preserving an upright frame // Not compiled or tested in-world // Setup: Use a spare owned prim. Set ORIGIN and TARGET with differentXY positions. Touch for private calculations. // Stop / restore: Disable/remove. No camera or object settings are changed. // Notes: Assumes local+X is the model front; no actual rotation is applied. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Transform planning only. vector ORIGIN=<4.0,5.0,1.0>; vector TARGET=<8.0,2.0,7.0>; default { touch_start(integer detectedCount) { if(llDetectedKey(0)!=llGetOwner())return; vector delta=TARGET-ORIGIN; delta.z=0.0; if(llVecMag(delta)<0.000001) { llOwnerSay("Target has no horizontal bearing."); return; } float yaw=llAtan2(delta.y,delta.x); llOwnerSay("Yaw degrees="+(string)(yaw*RAD_TO_DEG)+" rotation="+(string)llEuler2Rot(<0.0,0.0,yaw>)); } }