Karlos Zero Posted May 13, 2017 Share Posted May 13, 2017 Hi everyone, I am working on a script for a saddle sitter for avatars, and I managed to make the saddle move and turn, but once another avatar sits on it, the turning function stops completely. Not sure why since I am not an expert scripter, but I am sure I overlooked something. Will paste my script here and let me know your thoughts on the topic. rotation Turn; default { state_entry() { llSetTimerEvent(0.5); llSensorRepeat("", NULL_KEY, AGENT, 5, PI,0.5); llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); } timer() { vector OFFSET = <0,0,2>; vector OwnerPos = llList2Vector(llGetObjectDetails(llGetOwner(), [OBJECT_POS]),0) + OFFSET; llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION, OwnerPos]); llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION, Turn]); } sensor(integer num_detected) { Turn = llDetectedRot(0); } } Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 13, 2017 Share Posted May 13, 2017 llDetectecRot(0) in the sensor event will return the nearest avatar. That would be the one sitting on the object I guess. You could also get the rotation from the owner with llGetObjectDetails. Doing a llVecDist check for the 5 meter range as well could make the sensor obsolete entirely. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 14, 2017 Share Posted May 14, 2017 Your sensor will fail the instant that you are seated. At that point, you become a link in the seat's linkset, and an object cannot sense itself. 3 Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 14, 2017 Share Posted May 14, 2017 1 hour ago, Rolig Loon said: Your sensor will fail the instant that you are seated. At that point, you become a link in the seat's linkset, and an object cannot sense itself. I don't think that this is true actually. In that case Karlos script would have work (at least to some degree), because it would still get another avatar than the one which is nearest, the one sitting on the saddle. If I understand the purpose of this follower correctly, the saddle is meant to follow one avatar, which is the owner of the saddle as well, and a second avatar is just sitting on the saddle, riding the saddle owners avatar. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 14, 2017 Share Posted May 14, 2017 Oh, I didn't mean to imply that that's the only limitation, but it is a real one. The LSL wiki has a note to that effect: "Objects do not detect themselves, and attachments cannot detect their wearers (this includes HUD attachments)." and I've run into that problem many times. So, your earlier comment that " the sensor event will return the nearest avatar. That would be the one sitting on the object I guess. " won't wash. My guess is that the sensor's range is just too short to detect the nearby av. Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 14, 2017 Share Posted May 14, 2017 Well, a sat upon object isn't an attachment. Link to comment Share on other sites More sharing options...
Rolig Loon Posted May 14, 2017 Share Posted May 14, 2017 (edited) No, it's not. "Sitting" is linking yourself to another object, where you become the highest numbered link in the linkset. That object, which is the one that contains the sensor, cannot detect itself or any part of itself -- you. Edited May 14, 2017 by Rolig Loon Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 14, 2017 Share Posted May 14, 2017 Give it a shot when you are in-world. default { state_entry() { llSitTarget(<0.5, 0.0, 0.5>, ZERO_ROTATION); llSensorRepeat("", "",AGENT,5.0, PI, 2.0); } sensor(integer num_detected) { llOwnerSay(llKey2Name(llDetectedKey(0))); } } Link to comment Share on other sites More sharing options...
Karlos Zero Posted May 14, 2017 Author Share Posted May 14, 2017 (edited) Hi and thanks for the reply everyone! Arton's suggestion worked well. Since the object I am working on should detect the owner, I made the sensor filter that and thus it was resolved now the rotation worked well. Thanks for all the support! Just for clarification, the object is meant to be sat on by another avatar not the owner. Edited May 14, 2017 by Karlos Zero Link to comment Share on other sites More sharing options...
arton Rotaru Posted May 14, 2017 Share Posted May 14, 2017 (edited) @Karlos Zero The following script will do exactly the same as yours, but without a sensor. Just a suggestion. default { state_entry() { llSetTimerEvent(0.5); llSitTarget(<0.0, 0.0, 0.1>, ZERO_ROTATION); } timer() { vector OFFSET = <0,0,2>; list lGOD = llGetObjectDetails(llGetOwner(), [OBJECT_POS, OBJECT_ROT]); vector OwnerPos = llList2Vector(lGOD, 0); if (llVecDist(OwnerPos, llGetPos()) <= 5.0) { llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_POSITION, OwnerPos + OFFSET, PRIM_ROTATION, llList2Rot(lGOD, 1)]); } } } Edited May 14, 2017 by arton Rotaru 3 Link to comment Share on other sites More sharing options...
Berksey Posted May 16, 2017 Share Posted May 16, 2017 (edited) I was thinking it was a saddle to wear, I just wasn't sure and didn't want to open my mouth and look foolish... I forget sometimes how many people in SL are into playing horsey... I can think of other uses for the same stuff, too, like a piggyback baby carrier, etc. This is a good thread, IMO. ^-^ Edited May 16, 2017 by Berksey Link to comment Share on other sites More sharing options...
Ivanova Shostakovich Posted May 18, 2017 Share Posted May 18, 2017 Sometimes I forget how many brilliant people there are, always making cool things in SL. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now