|
Victor Reisman
Smithy of SL
Join date: 5 May 2006
Posts: 18
|
10-07-2008 23:04
I'll try to keep my question as simple as possible. I want on object to be able to detect its distance from the owner and return it in one numerical value (or 3 - x,y,z) doesn't really matter. Really, its because after the object I'm making fly's out, I want to have it run a check, and after it reaches a certain distance, I would like it to change states and do something else. I hope I made this as simple as possible. Any helpful hints or points in the right direction are greatly appreciated.
Thanks in advance.
_____________________
Stylize, Revolutionize, Whatever your game is, Second Life is a new world with unlimited potential, and I intend to push the unlimited.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
10-08-2008 00:17
llGetObjectDetails() should be your friend here. Something like: (Note: not yet compiled; may need a minor syntax fix or two.) // Returns negative distance if owner is not present (e.g. logged out or not in // the same sim). float getDistanceToOwner() { list details = llGetObjectDetails(llGetOwner(), [ OBJECT_POS ]); if (llGetListLength(details) < 1) { return -1.0; } vector ownerPos = llList2Vector(details, 0);
return llVecDist(llGetPos(), ownerPos); }
|
|
Victor Reisman
Smithy of SL
Join date: 5 May 2006
Posts: 18
|
10-08-2008 10:18
Awesome socks, it worked perfectly for what I needed. And I was able to learn a few things too ;D
_____________________
Stylize, Revolutionize, Whatever your game is, Second Life is a new world with unlimited potential, and I intend to push the unlimited.
|