Jump to content

Getting the coordinates of my region


Sledge Kappler
 Share

You are about to reply to a thread that has been inactive for 4099 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi, i've looked all around, but i haven't found what i need.

I am looking for a piece of script, that gives me the coordinates (x,y to x,y) or (x,y and width and length).

What i need it for? For example: If an object is rezzing, it can calculate the center (x,y) of the region where it is rezzing in and can move to that point.

Any ideas?

Greetings

Sledge

 

 

 

 

Link to comment
Share on other sites

llSetLinkPrimitiveParamsFast(!!llGetLinkNumber(), [PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION, <128.0,128.0,128.0>])

 The above will go to the coordinates <128,128,128> instantly. If you only want it to go to center but not change height:

 

vector pos = llGetPos();llSetLinkPrimitiveParamsFast(!!llGetLinkNumber(), [PRIM_POSITION, <1.304382E+19, 1.304382E+19, 0.0>, PRIM_POSITION, <128.0,128.0,pos.z>])

 

  • Like 1
Link to comment
Share on other sites

there are no functions to get the shape or position of a parcel within a region. parcels may not be square, or solid (may have cutouts)

if this should only work on particular parcels, you can instead detect the region and/or parcel name and move to a hard coded position within that region

  • Like 1
Link to comment
Share on other sites

It can be a pain to do this. You can loop thru the region coordinates in rows and columns, with 4m skips, and use llGetParcelDetails to match IDs. Average the extremes to find a good guess at the center, but should add a "next best match" fallback in case the parcel is not a regular shape.

  • Like 1
Link to comment
Share on other sites

Hi, but it is possible that the calculation start pos isn't on exact a 4 m boundary. So 1 m steps will be more exactly.

 

For example. Parcel start is as (0,0) (z ignored) and has a width of 32 meter (ends at 32,0).

When rezzing at (2,0) and calculating with 4 Meter steps then ending is at (34,0) (or 30,0) .

 

Greetings

Link to comment
Share on other sites


Sledge Kappler wrote:

Hi, but it is possible that the calculation start pos isn't on exact a 4 m boundary. So 1 m steps will be more exactly.

 For example. Parcel start is as (0,0) (z ignored) and has a width of 32 meter (ends at 32,0).

When rezzing at (2,0) and calculating with 4 Meter steps then ending is at (34,0) (or 30,0) .

Using 4 meters is just so exact as if you use 1 meter

You only have to do a little calculation

the offset you added to the start(2m) you just subtract from the result and you land on the spot exact.

Something like this:

for ( row=0; row<256; row+=4)

for ( col=0; col<256; col+=4)

if ( landat(row,col,0) is on the parcel) { do what it is you want to do with the <row,col,0.0>to<row+4,col+4,0> land unit}

will do and it doesn't even have an offset:smileyvery-happy:

You may use llGetParcelDetails to obtain parcel name. parcel owner etc.

If for some reason you don't start on the 4 by 4 meter grid you just round your number so it is on the grid:

x=4.0*llFloor(x/4.0);

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4099 days.

Please take a moment to consider if this thread is worth bumping.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...