|
Taeas Stirling
Registered User
Join date: 4 Sep 2004
Posts: 74
|
07-24-2006 14:00
Found this in the wiki, spent an hour or so playing with it. Seems to be broken, the object launches its self off world, or just ghosts at the first sim line. And if its broken, why is it in the wiki???  ( // Pass a global position to this function, and the object // will move there. setGlobalPos(vector globalDest) { vector localDest; do { localDest = globalDest - llGetRegionCorner(); llSetPos(localDest); } while (llVecDist(llGetPos(), localDest) > 0.1); }
default { state_entry() { vector CORTEZ_CORNER = <261888.0, 255488.0, 0> * 256; // DaBoom's region corner. setGlobalPos(CORTEZ_CORNER + <128, 128, 20>); // Travel to <128,128,128> in DaBoom. } }
|
|
Snake Ornitz
Basic builder/scripter
Join date: 26 Oct 2005
Posts: 7
|
07-24-2006 16:11
Well, are you in the same region as the script says. Else the object will just fly off the world.
|
|
Taeas Stirling
Registered User
Join date: 4 Sep 2004
Posts: 74
|
is this broken
07-24-2006 16:49
that script was preceded by this bit of text that left me with the impression that it would indeed cross sims (taken from the wiki page on global coordinates)
Using global coordinates, it's easy to create an object that can traverse the world. llSetPos and llMoveToTarget use region coordiantes; to use these functions to travel to a particular global coordinate, pass the result of subtracting the current region's corner from the global coordinate to the function. This converts the global coordinate into a region coordinate.
Example:
All tests were launched 2 void sims south of the destination sim Cortez.
|
|
Rodrick Harrington
Registered User
Join date: 9 Jul 2005
Posts: 150
|
07-26-2006 19:08
two things to check for . . . #1 are you accurately passing it a world coordinate for the target location? (llOwnerSay is our friend) and #2 can it go in a straight line from where it is at to where you want it to go without going offworld?
|
|
Christopher Omega
Oxymoron
Join date: 28 Mar 2003
Posts: 1,828
|
07-27-2006 09:10
The wiki could be wrong about DaBoom's region corner. Go to DaBoom and llOwnerSay the value returned from llGetRegionCorner. If the wiki's wrong, feel free to change it. Using the setGlobalPos will allow you to place the object at a position on the SL grid. The vector you pass to setGlobalPos is not relative to any simulator, so it should not be dependant on what simulator the object is currently in. However, the object must have a continuous straight path from its current position to its destination. If the straight-line path crosses into an offworld area at any time, the object will go offworld. AH! I just looked at the wiki page - it seems as though it conveys that <1000, 1000, 0> is Daboom's region corner, when (<1000, 1000, 0>*256) or <256000, 256000, 0> is the actual value. I corrected the page to make it a little less ambiguous. Just remember: GlobalCoordinate = RegionCorner + RegionLocalCoordinate; so if you want to go to <50, 50, 50> in Daboom, what you pass to the function is (<256000, 256000, 0> + <50, 50, 50>  , or <256050, 256050, 50>. ==Chris
|