Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007861opensim[REGION] Script Functionspublic2016-03-24 15:572019-02-06 11:30
ReporterKayaker Magic 
Assigned ToDiva 
Platformlinux/monoOperating SystemOpenSim Dev OSgrid & ubODEOperating System Version0.9.0.0
Product Versionmaster (dev code) 
Target VersionFixed in Version 
Summary0007861: llEdgeOfWorld fails most of the time in a 1x1 region
DescriptionI hoped that llEdgeOfWorld would work in vars, but was disappointed. Then I tried it out in regular regions and was horrified to discover that it fails there most of the time also. If you give it a unit vector in one of the cardinal directions, it does work, but if your direction vector is not a unit vector, even if it is not quite pointing in a cardinal direction by as little as 1e-6 (not visible in the output) it fails and returns 1 when there is another region on the other side of the border.
I tested this in two regions that were running in two separate instances, sitting next to each other in OSgrid. I was able to drag the prim back and forth across the border AND SHOW IT the other region, but it failed on both sides.
Steps To ReproducePut the following script in a prim. Put it in a regular region that has neighbors on at least one side. Click on it. The cardinal directions will correctly show 0 on the sides with neighbors. Extra credit: Change the cardinal vectors to values like <2,0,0> and note that it then FAILS to detect neighbors. The X direction should return 0 when pointing at a neighbor prim but never does. Try pointing the prim directly at (0, 90, 180 or 270 degrees) a neighbor prim and clicking it again. The output for the X direction vector will look identical to one of the cardinal vectors, but it will still fail to detect the neighbor.
I tried several experiments:
XN: Sometimes normalizing the direction vector (again) makes it work right, this is the XN result.
XS: I thought converting the direction vector to a string and back would remove residual floating point values, but this never helped.
XX: Collapsing the direction vector onto one of the cardinal directions did work, but of course this will get the wrong answer for many angles and positions.
Additional Informationdefault
        llSay(0, "Script running");
    touch_start(integer num)
        vector dir;
        dir = <0,1,0>; //north
        llOwnerSay((string)dir+"N "+(string)llEdgeOfWorld(llGetPos(),dir));
        dir = <1,0,0>; //east
        llOwnerSay((string)dir+"E "+(string)llEdgeOfWorld(llGetPos(),dir));
        dir = <0,-1,0>; //south
        llOwnerSay((string)dir+"S "+(string)llEdgeOfWorld(llGetPos(),dir));
        dir = <-1,0,0>; //west
        llOwnerSay((string)dir+"W "+(string)llEdgeOfWorld(llGetPos(),dir));
        dir = <1,0,0>*llGetRot(); //check in the +X direction of the prim
        llOwnerSay((string)dir+"X "+(string)llEdgeOfWorld(llGetPos(),dir));
        llOwnerSay((string)llVecNorm(dir)+"XN "+(string)llEdgeOfWorld(llGetPos(),llVecNorm(dir)));
        llOwnerSay((string)dir+"XS "+(string)llEdgeOfWorld(llGetPos(),(vector)((string)dir)));
                //the x direction FAILS if the prim is not pointing
                //EXACTLY in a cardinal direction within 6 decimal places
                //To get it to work, you have to force the vector components
                //to EXACTLY -1, 0 or +1 (of cource this fails for many angles
                //far from the edge or near 45 degrees)
        if (dir.x >0.707) dir.x=1;
        else if (dir.x >=-0.707) dir.x=0;
        else dir.x = -1;
        if (dir.y >0.707) dir.y=1;
        else if (dir.y >=-0.707) dir.y=0;
        else dir.y = -1;
        llOwnerSay((string)dir+"XX "+(string)llEdgeOfWorld(llGetPos(),dir));
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (Multiple Regions per Sim)
Physics EngineOther
Script Engine
EnvironmentMono / Linux64
Mono Version3.0
Attached Files

- Relationships

-  Notes
Diva (administrator)
2016-06-12 14:49

[14:48] <cia-opensim> opensim: diva * rc2e63e807e4b OpenSim/Region/ScriptEngine/Shared/Api/Implementation (LSL_Api.cs):
[14:48] <cia-opensim> Mantis 0007861. llEdgeOfWorld not working. Two reasons: (1) edge was being filled but not used; (2) region size was being ignored when computing the neighbors' coordinates.
[14:48] <cia-opensim> Not sure if this is the intended semantics of this function, but it made sense in my varregion test with neighbors all around except in the South.
Diva (administrator)
2016-06-16 15:48

Can someone please verify if this is fixed?
Gavin Hird (reporter)
2016-06-19 01:12

From the output of the script it looks like it works on regular size regions with the patch taken.
Mandarinka Tasty (reporter)
2016-06-19 10:31

Diva's patch looks nice :)

but i have diplomatic question:

Please open:


and go to:

public LSL_Integer llEdgeOfWorld(LSL_Vector pos, LSL_Vector dir)

Let's consider following situation:

when dir.x !=0 ( not equal to zero )

then please tell me what is value of edge.x


if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0) ??

I'm asking because we have only set, for this case, edge.y

if (edge.y > World.RegionInfo.RegionSizeY || edge.y < 0)
                    // Y goes out of bounds first
                    edge.y = dir.y / Math.Abs(dir.y) * (World.RegionInfo.RegionSizeY / Constants.RegionSize);

So what is going to be set here:

uint neighborX = World.RegionInfo.RegionLocX + (uint)edge.x;
uint neighborY = World.RegionInfo.RegionLocY + (uint)edge.y;

if not edge.x ?
BillBlight (developer)
2019-02-06 11:30

Marked as Resolved but never closed, can be reopened if needed.

- Issue History
Date Modified Username Field Change
2016-03-24 15:57 Kayaker Magic New Issue
2016-06-12 14:49 Diva Note Added: 0030470
2016-06-16 15:48 Diva Note Added: 0030543
2016-06-19 01:12 Gavin Hird Note Added: 0030566
2016-06-19 10:31 Mandarinka Tasty Note Added: 0030578
2016-06-19 14:42 Diva Status new => resolved
2016-06-19 14:42 Diva Resolution open => fixed
2016-06-19 14:42 Diva Assigned To => Diva
2019-02-06 11:30 BillBlight Note Added: 0034529
2019-02-06 11:30 BillBlight Status resolved => closed

Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker