Difference between revisions of "Talk:LlSetRegionPos"

From Second Life Wiki
Jump to: navigation, search
(Woot!)
(Woot!)
Line 5: Line 5:
 
Does the "success tolerance" of 0.1m hint that the function is for some reason prone to hitting with that wide an error, or is it just a very, very, very safe margin for a floating point roundoff of the requested location?
 
Does the "success tolerance" of 0.1m hint that the function is for some reason prone to hitting with that wide an error, or is it just a very, very, very safe margin for a floating point roundoff of the requested location?
 
[[User:Tali Rosca|Tali Rosca]] 10:10, 3 March 2012 (PST)
 
[[User:Tali Rosca|Tali Rosca]] 10:10, 3 March 2012 (PST)
 +
 +
 +
The comment about warpPos is wrong
 +
The error is <= 1e-6 .
 +
( except of course if you try to go under the ground )
 +
Tested on Linden Sandbox Magnum RC :
 +
5000 llSetregionpos with random values ;
 +
for z values < ground , we raise z;
 +
Result : the 5000 llsetregionpos go to a correct position
 +
<lsl>
 +
default
 +
{
 +
 +
    touch_start(integer total_number)
 +
    {
 +
 +
        integer numberTests = 5000 ;
 +
        integer n = 1;
 +
        vector d;
 +
        float h;
 +
        vector posTouched = llGetPos();
 +
        do
 +
        {
 +
            d = <llFrand(256.0), llFrand(256.0), llFrand(4096.0)>;
 +
            h = llGround(d-llGetPos());
 +
            if ( d.z <= h )
 +
                d.z = h + 1.0;
 +
            llSetRegionPos(d);
 +
            llOwnerSay(llList2CSV([ "test #", n, "error", llGetPos()-d, "pos",llGetPos(), "dest", d ]));
 +
            n++;
 +
        } while ( ((llGetPos()-d) == ZERO_VECTOR ) && ( n <= numberTests) ) ;
 +
        llSetRegionPos(posTouched);
 +
    }
 +
}
 +
 +
</lsl> [[User:Miranda Umino|Miranda Umino]] 08:02, 6 March 2013 (PST)

Revision as of 08:02, 6 March 2013

Woot!

Woot!  :) Dale Innis 10:33, 8 February 2012 (PST)

Does the "success tolerance" of 0.1m hint that the function is for some reason prone to hitting with that wide an error, or is it just a very, very, very safe margin for a floating point roundoff of the requested location? Tali Rosca 10:10, 3 March 2012 (PST)


The comment about warpPos is wrong The error is <= 1e-6 . ( except of course if you try to go under the ground ) Tested on Linden Sandbox Magnum RC : 5000 llSetregionpos with random values ; for z values < ground , we raise z; Result : the 5000 llsetregionpos go to a correct position <lsl> default {

   touch_start(integer total_number)
   {
       integer numberTests = 5000 ;
       integer n = 1;
       vector d;
       float h;
       vector posTouched = llGetPos();
       do
       { 
           d = <llFrand(256.0), llFrand(256.0), llFrand(4096.0)>;
           h = llGround(d-llGetPos());
           if ( d.z <= h )
               d.z = h + 1.0;
           llSetRegionPos(d);
           llOwnerSay(llList2CSV([ "test #", n, "error", llGetPos()-d, "pos",llGetPos(), "dest", d ]));
           n++;
       } while ( ((llGetPos()-d) == ZERO_VECTOR ) && ( n <= numberTests) ) ;
       llSetRegionPos(posTouched);
   }

}

</lsl> Miranda Umino 08:02, 6 March 2013 (PST)