Skip to content
lsl.devlsl.devLSL Dev

llGetRegionCorner

function
Function syntax
vector llGetRegionCorner();
Returns
vector
Energy
10

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

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

How to use
vector result = llGetRegionCorner();
Example 1
10 collapsed lines
// 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>
6 collapsed lines
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
}
}

The great zero is at region offset <1000,1000>,

Original wiki source

Some wiki templates and tables need their original context. View this article on the Second Life Wiki. Technical wording and examples are retained from the source; historical guidance may differ from current behavior.

From the Second Life Wiki

Community documentation adapted from LlGetRegionCorner, by Linden Research, Inc. and contributing residents.View contributors and history.

Imported wiki revision:

Licensed under CC BY-SA 3.0. Last wiki edit: .Formatting and links have been adapted for this site; API metadata follows the LSL definitions.