FindScreenWidth: Difference between revisions
Jump to navigation
Jump to search
New page: The script below will give the width of the screen in meters by touching anywhere on the visible face, given that the prim is a box with zero rotation and attached at one of the corner HUD... |
mNo edit summary |
||
| Line 2: | Line 2: | ||
<lsl> | <lsl>//Find Screen Width | ||
//Find Screen Width | |||
//By Darwin Recreant | //By Darwin Recreant | ||
| Line 19: | Line 18: | ||
llOwnerSay((string)screen_width); | llOwnerSay((string)screen_width); | ||
} | } | ||
} | }</lsl> | ||
</lsl> | |||
{{LSLC|Examples}} | {{LSLC|Examples}} | ||
Revision as of 10:42, 26 November 2008
The script below will give the width of the screen in meters by touching anywhere on the visible face, given that the prim is a box with zero rotation and attached at one of the corner HUD attachment points.
<lsl>//Find Screen Width
//By Darwin Recreant
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);
}
}</lsl>