Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
01-18-2006 05:57
I'm having a bit of trouble moving a box around with llDetectedGrab. This is the code for the detector prim default { state_entry() { llSetStatus(STATUS_BLOCK_GRAB, TRUE); llSetStatus(STATUS_ROTATE_X | STATUS_ROTATE_Y | STATUS_ROTATE_Z, FALSE); } touch(integer tn) { if(llDetectedGrab(0) != ZERO_VECTOR) { llMessageLinked(LINK_SET, 0, (string)llDetectedGrab(0), NULL_KEY); } } }
This is the code in the movement prim default { link_message(integer sender_num, integer num, string str, key id) { vector movepos = (vector)str; vector newpos = llGetPos() + <0, movepos.y, movepos.z>; llSetPos(newpos); } }
With this code I'm tryng to restrict the movement to the yz-plane, but it moves around in all directions. vector newpos = llGetPos() + <0, movepos.y, movepos.z>; llSetPos(newpos); What am I doing wrong?
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
01-18-2006 11:43
I was playing around with llDetectedGrab a couple of days ago, and I couldn't get it to return anything other than the zero vector. Maybe it's broken?
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
01-18-2006 11:51
From: Seifert Surface I was playing around with llDetectedGrab a couple of days ago, and I couldn't get it to return anything other than the zero vector. Maybe it's broken? That's why I use two prims, a detector prim and a movement prim. After I make the prims I select the detector prim, make it physical, select the movement prim and then link them together. The linked set will be nonphysical but since physics was enabled on the detector prim before they were linked, it will return a value.
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
01-19-2006 04:32
Nevermind, I found the problem. Too many link messages. Adding a little llSleep after sending the link message in the detector prim makes it work.
|