Talk:LlSetRegionPos

From Second Life Wiki
Revision as of 09:30, 6 March 2013 by Miranda Umino (talk | contribs)
Jump to navigation Jump to search

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)

In fact , i guess the function doeesn t try to move an object with 0.1 meters : it moves an object EXACTLY to the position . But it can t move an object under the ground . And the function returns a value to inform succes or failure , it exists a test "if within 0.1 meters" to know if the object was high and has been capped by the ground , or if the object was already near the ground before the call of the function Miranda Umino 08:30, 6 March 2013 (PST)