Difference between revisions of "LlGetRegionCorner"
Jump to navigation
Jump to search
Gigs Taggart (talk | contribs) (template move) |
m (<lsl> tag to <source>) |
||
(11 intermediate revisions by 6 users not shown) | |||
Line 1: | Line 1: | ||
{{LSL_Function | {{LSL_Function | ||
|func=llGetRegionCorner | |func=llGetRegionCorner|sort=GetRegionCorner | ||
|func_id=199 | |func_id=199|func_sleep=0.0|func_energy=10.0 | ||
|func_sleep=0.0 | |func_desc | ||
|func_energy=10.0 | |func_footnote=Divide the returned value by 256 to get the region offset. | ||
| | |||
| | |||
|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 | ||
|constants | |constants | ||
|spec | |spec | ||
|caveats | |caveats | ||
|examples | |examples=<source 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,1,1>, 2.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) +",\t\t\t"+ (string)llRound(vecrel.y) +",\t\t\t"+ (string)llRound(vecrel.z) + "."); | |||
llWhisper(0, "Position relative to <0,0,0> of 'Da Boom':"+(string)vecrel ); //faster but unformatted output | |||
} | |||
} | |||
</source> | |||
|helpers | |helpers | ||
|also_header | |also_header | ||
Line 32: | Line 35: | ||
|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 | ||
|location | |location | ||
|cat1=Region | |||
|cat1 | |||
|cat2 | |cat2 | ||
|cat3 | |cat3 | ||
Line 46: | Line 45: | ||
|cat6 | |cat6 | ||
}} | }} | ||
Revision as of 02:45, 22 January 2015
LSL Portal | Functions | Events | Types | Operators | Constants | Flow Control | Script Library | Categorized Library | Tutorials |
Summary
Function: vector llGetRegionCorner( );199 | Function ID |
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.
Caveats
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,1,1>, 2.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) +",\t\t\t"+ (string)llRound(vecrel.y) +",\t\t\t"+ (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🖈