Talk:LlDetectedGrab

From Second Life Wiki
Jump to navigation Jump to search

The example below causes an inaccurate return of <0.0,0.0,0.0> when I grab the object the script is in. Thus the spoken result is far from correct (unless I stand in the corner if the region! lol). Since I was trying to write an example I have nothing to go on to discover if I am using this function correctly. Would anyone care to comment?

<lsl> default {

   state_entry()
   {
       llSetStatus(PRIM_PHYSICS,TRUE);
   }
   touch_start(integer num_detected)
   {
       llSay(0,(string)llKey2Name(llDetectedKey(0)) + " has grabbed me from roughly" 
       + (string)llRound(llVecDist(llDetectedGrab(0), llGetPos())) + " meters away.");
   }

} </lsl>

Eddy 06:31, 14 May 2009 (UTC)

Uhhh it's been a while since I've used llDetectedGrab and the article is all boiler plate (makes some effort to fix). The function is only useful in the touch event, where it will returns the vector which is the direction of the dragging motion. I could be wrong about the last bit... it's been a couple years since I've played with it. It has some strange effects when used in HUD attachments which make it very difficult to use I recall. -- Strife (talk|contribs) 10:56, 14 May 2009 (UTC)

Hiya Strife. The direction not the distance? Urgh. I can't think what to say about that but tooltips should be the first against the wall when the revolution comes. I'll have another look at it. I'm guessing your goo computer is still offline. Difficult to take a quick gander in that case. See ya in the mix. -- Eddy 07:36, 15 May 2009 (UTC)

Ahhhh. touch not touch_start. I missed that one. Ooops -- Eddy 07:40, 15 May 2009 (UTC)

wow that's different. Good god. It may take a lil bit of thinking to make an example but I am going to give it a go.

<lsl> default {

   state_entry()
   {
       llSetStatus(PRIM_PHYSICS,TRUE);
   }
   touch(integer num_detected)
   {
       llSay(0,(string)llDetectedGrab(0));
   }

} </lsl>

Returned a lot of data while moving the prim. Trying to figure a way to make it useful is another matter. But I am really keen on trying.

Thanx for the heads up AGAIN.

P.s. touch is an interesting event. Gonna have to look into that one -- Eddy 07:51, 15 May 2009 (UTC)

llDetectedGrab was always a strange function. -- Strife (talk|contribs) 14:19, 15 May 2009 (UTC)

Well Strife...other than working out that the "offset" is the offset between the detected grab and the center of the object (haven't looked into multi prim objects yet) and thus found that this function only returns anything even close to interesting if one tries to fling the object away while grab dragging (as if trying to shake a blob of sticky stuff off your hand). I can honestly say that I can't think of any obvious way to use it. So I am posting the llSay script above with a small note to explain my findings. -- Eddy 15:26, 19 May 2009 (UTC)

Prior to the touch position functions, this function was the only way to do draggable controls (slides etc). Due to update lag they were never practical. -- Strife (talk|contribs) 16:15, 19 May 2009 (UTC)

Ahhhh. *slumps* -- Eddy 19:02, 19 May 2009 (UTC)