float llGetAspectRatio();
This would return the aspect ratio of the wearing agent's screen. For privacy purposes(i.e. preventing "fingerprinting"), this should only work on the agent wearing the object, and if the object is attached to the hud.
The data would be pulled from the existing AgentHeightWidth packet, and would be the result of AgentHeightWidth.HeightWidthBlock.Width / AgentHeightWidth.HeightWidthBlock.Height.
This is currently possible, but in a tedious way. A resident must attach a object to one of the corners of the HUD with the following script:
default
{
touch_start(integer total_number)
{
vector scale = llGetScale();
vector off_point = llGetLocalPos();
vector face_pos = llDetectedTouchST(0);
vector screen_pos = llDetectedTouchPos(0);
float screen_width = ((face_pos.x-.5)*scale.y-off_point.y+screen_pos.y)*2;
llOwnerSay((string)screen_width);
}
}
Example output:
Assuming the following block has been sent to the server:
AgentHeightWidth
AgentData
AgentID 796b1537-70d8-497d-934e-0abcc2a60050
SessionID 00000000-0000-0000-0000-000000000000
HeightWidthBlock
GenCounter 0
Height 1061
Width 1920
And object's root is attached to ATTACH_HUD_*
Then the following should be true:
llGetAspectRatio() == 1.8096135721017907 //(1920 / 1061)
If not attached to HUD, or the simulator has no AgentWidthHeight cached, then return 0 or FALSE. This will be safe as no screen will can have a ratio of zero.
Created by Signal Linden
December 12, 2023