Difference between revisions of "LlGetRegionCorner"
Jump to navigation
Jump to search
m |
(+ example) |
||
Line 9: | Line 9: | ||
|spec | |spec | ||
|caveats | |caveats | ||
|examples | |examples=<pre>//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() + llGetPos(); | |||
llWhisper(0, "llGetRegionCorner() is:"+(string)vecrel ); //for debugging before vector addition | |||
vecrel.x = vecrel.x - 256000; | |||
vecrel.y = vecrel.y - 256000; | |||
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 | |||
} | |||
} | |||
</pre> | |||
|helpers | |helpers | ||
|also_header | |also_header |
Revision as of 04:54, 25 November 2007
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() + llGetPos(); llWhisper(0, "llGetRegionCorner() is:"+(string)vecrel ); //for debugging before vector addition vecrel.x = vecrel.x - 256000; vecrel.y = vecrel.y - 256000; 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🖈