Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Lost Objects vs Other Regions

Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
09-28-2008 08:01
heyas;

okay, i made a piggy run around and stay within X meters of its start point. if it gets past X meters, it uses llSetPos(homepos) to jump to/towards its home. if it gets past 1.5*X, it uses a 'warppos' effect to get home.

now... if the piggy crosses into another sim and attempts to set its position to its homepos... wouldnt that put it at the memorized coordinates, but in the wrong sim. right?

and... i dont want to use 'status sandbox' because besides not letting things cross sim borders, it also restricts movement to 10m and turns objects non-physical.


what would be the best way to ensure a piggy cannot escape into a neighboring sim? i can keep track of which sim its supposed to be in, but then how can it 'teleport' itself to, say, a slurl or something?
_____________________
Why Johnny Can't Rotate:
http://forums.secondlife.com/showthread.php?t=94705
Qie Niangao
Coin-operated
Join date: 24 May 2006
Posts: 7,138
09-28-2008 13:58
One approach might be to remember the "home" location by global coordinates (llGetPos() + llGetRegionCorner() so the piggy knows how far away it really is, and which direction to run.

Just preventing it from wandering past a sim border, though, would be a matter of not allowing the X or Y coordinates to get out of the 0..256 bounds, right?

As for teleporting, well, if pigs could fly... ;) (I'd suppose that "home" would be reset for piggy upon arrival at teleport destination. Although how it gets safely to that destination without encountering llScriptDanger() along the way... more difficult.)
Bloodsong Termagant
Manic Artist
Join date: 22 Jan 2007
Posts: 615
09-29-2008 07:29
heyas;

so.. if i get its global coordinates with the pos + region whatever... how do i STICK it back at those coordinates? llsetpos aint gonna cut it, i would presume.

someone else suggested damping the move to target coordinates to stay in sim. however, the pig does not use moveto target coordinates. it rotates a random amount then uses an impulse. the only way it would know its at the wrong coordinates is after the fact. :/


on changed region, i have to... look at its global pos vs its global home pos, and.... i guess im going to use this move to target routine? towards target? can i move it a relative distance somehow? like... calculate it is 30m away on the y axis, so go -30m on y? i can change it non physical if needed to move it like that.

==============================

wohoo got it!

example right on the wiki for global position.
http://lslwiki.net/lslwiki/wakka.php?wakka=GlobalCoordinate

easier than i thought!