Difference between revisions of "LlGetRegionCorner"

From Second Life Wiki
Jump to navigation Jump to search
(template move)
m (Replaced <source> with <syntaxhighlight> and added a haiku generated by ChatGPT.)
 
(16 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{LSL_Function
{{LSL_Function
|func_id=199|func_sleep=0.0|func_energy=10.0
|func=llGetRegionCorner
|func=llGetRegionCorner
|func_id=199
|func_desc
|func_sleep=0.0
|func_footnote=Divide the returned value by 256 to get the region offset.
|func_energy=10.0
|sort=GetRegionCorner
|func_desc=Returns a vector with the south west corner x,y position of the region the object is in
|func_footnote
|return_type=vector
|return_type=vector
|return_text
|return_text=in meters that is the global location of the south-west corner of the region the object is in. The z component is 0.0
|p1_type|p1_name|p1_desc
|p2_type|p2_name|p2_desc
|p3_type|p3_name|p3_desc
|p4_type|p4_name|p4_desc
|p5_type|p5_name|p5_desc
|p6_type|p6_name|p6_desc
|p7_type|p7_name|p7_desc
|p8_type|p8_name|p8_desc
|p9_type|p9_name|p9_desc
|p10_type|p10_name|p10_desc
|p11_type|p11_name|p11_desc
|p12_type|p12_name|p12_desc
|constants
|constants
|spec
|spec
|caveats
|caveats
|examples
|examples=
<syntaxhighlight lang="lsl2">
// Calculates your position relative to <0,0,0> of 'Da Boom' in meters when you touch it
vector vecrel; //a sum of llgetpos and llgetregioncorner (and another vector). Saving time doing vector math.
 
default
{
    state_entry()
    {
        llSetText("Touch me to get your position", <1.0,1.0,1.0>, 1.0);
    }
   
    touch_start(integer total_number)
    {
        vecrel = llGetRegionCorner() + llDetectedPos(0);
        llWhisper(0, "llGetRegionCorner() is:"+(string)vecrel); //for debugging before vector addition
       
        vecrel -= <256000.0, 256000.0, 0.0>;//Da Boom's region corner is at <256000.0, 256000.0, 0.0>
        llWhisper (0, "Position relative to <0,0,0> of 'Da Boom': " +
        (string)llRound(vecrel.x) + ", " + (string)llRound(vecrel.y) + ", " + (string)llRound(vecrel.z) + ".");
       
        llWhisper(0, "Position relative to <0,0,0> of 'Da Boom':" +(string)vecrel); //faster but unformatted output
    }
}
</syntaxhighlight>
|helpers
|helpers
|haiku={{Haiku|Code lines whisper low|llGetRegionCorner unfolds|Meters reveal truth.}}
|also_header
|also_header
|also_functions
|also_functions
Line 32: Line 42:
|also_articles
|also_articles
|also_footer
|also_footer
|notes
|notes=The great zero is at region offset <1000,1000>, {{SLurl|region=Da Boom|x=0|y=0|title=Great Zero}}
|mode
|mode
|deprecated
|location
|location
|inventory
|cat1=Region
|permission
|negative_index
|cat1
|cat2
|cat2
|cat3
|cat3
Line 46: Line 52:
|cat6
|cat6
}}
}}
[[Category:LSL_Stub]]

Latest revision as of 14:43, 24 January 2024

Summary

Function: vector llGetRegionCorner( );
0.0 Forced Delay
10.0 Energy

Returns a vector in meters that is the global location of the south-west corner of the region the object is in. The z component is 0.0

Divide the returned value by 256 to get the region offset.

Examples

// Calculates your position relative to <0,0,0> of 'Da Boom' in meters when you touch it
vector vecrel; //a sum of llgetpos and llgetregioncorner (and another vector). Saving time doing vector math.

default
{
    state_entry()
    {
        llSetText("Touch me to get your position", <1.0,1.0,1.0>, 1.0);
    }
    
    touch_start(integer total_number)
    {
        vecrel = llGetRegionCorner() + llDetectedPos(0);
        llWhisper(0, "llGetRegionCorner() is:"+(string)vecrel); //for debugging before vector addition
        
        vecrel -= <256000.0, 256000.0, 0.0>;//Da Boom's region corner is at <256000.0, 256000.0, 0.0>
        llWhisper (0, "Position relative to <0,0,0> of 'Da Boom': " + 
        (string)llRound(vecrel.x) + ", " + (string)llRound(vecrel.y) + ", " + (string)llRound(vecrel.z) + ".");
        
        llWhisper(0, "Position relative to <0,0,0> of 'Da Boom':" +(string)vecrel); //faster but unformatted output
    }
}

Notes

The great zero is at region offset <1000,1000>, Great Zero🖈

Deep Notes

Signature

function vector llGetRegionCorner();

Haiku

Code lines whisper low
llGetRegionCorner unfolds
Meters reveal truth.