[Opensim-users] Sit Target difficulties

James Hughes jamesh at bluewallgroup.com
Fri May 25 14:42:16 UTC 2012


Here are a couple of scripts to help you with the sit position...


Place this script in the object you want to set the sit position for...

// Sit target system by Lex Neva. Please distribute willy-nilly.

default
{
     touch_start(integer total_number)
     {
         llSensor("Sit Target Helper",
                 NULL_KEY, ACTIVE|PASSIVE, 96, PI);
         llSay(0, "Searching for Sit Target Helper...");
     }

     no_sensor()
     {
         llSay(0, "Sit Target Helper not found. No sit target set.");
         llSitTarget(ZERO_VECTOR, ZERO_ROTATION);
     }

     sensor(integer num)
     {
         if (num > 1)
         {
             llSay(0, "Multiple Sit Target Helpers found. Using closest 
helper.");
         } else {
             llSay(0, "Sit Target Helper found. Setting sit target.");
         }

         vector helper_pos = llDetectedPos(0);
         rotation helper_rot = llDetectedRot(0);

         vector my_pos = llGetPos();
         rotation my_rot = llGetRot();

         // calculate where the avatar actually is
         vector avatar_pos = helper_pos + <0,0,1> * helper_rot;
         // due to helper's sit target
         avatar_pos = avatar_pos - <0,0,0.186> + <0,0,0.4> * helper_rot; 
         // correct for a bug in llSitTarget(), for helper sit target

         vector target_pos = (avatar_pos - my_pos) / my_rot;
         target_pos = target_pos + <0,0,0.186>/my_rot - <0,0,0.4>; // 
       correct for the bug again, this time in my sit target
         rotation target_rot = helper_rot / my_rot;

         llSitTarget(target_pos, target_rot);
         llSay(0, "llSitTarget(" + (string)target_pos +
                     ", " + (string)target_rot + ");");
     }

     changed(integer change)
     {
         if (llAvatarOnSitTarget() != NULL_KEY)
             llRequestPermissions(llAvatarOnSitTarget(),
                 PERMISSION_TRIGGER_ANIMATION);
     }

     run_time_permissions(integer perm) {
         string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
         if (anim != "")
         {
             llStopAnimation("sit");
             llStopAnimation("sit_generic");
             llStopAnimation("sit_female");
             llStartAnimation(anim);
         }
     }
}


Make a "Sit Target Helper"...

Create a sphere and shrink it to about 0.25 and set the name of the 
object to "Sit Target Helper". Place this script inside it. And if you 
will be using an animation in your object, then place it inside this 
"Sit Target Helper" too. It will play the animation while you make the 
adjustment.


Make the sit position adjustment...

You will sit the avatar on this object and move it around until you are 
at the position you want. When you are satisfied with the adjustment, 
touch the object that you placed the above script in. It will print the 
llSitTarget command in chat with the right parameters for your 
adjustment. Use that llSitTarget in your object and remove the helper 
script.



default
{
     state_entry()
     {
         llSitTarget(<0,0,1>, ZERO_ROTATION);
     }

     changed(integer change)
     {
         if (llAvatarOnSitTarget() != NULL_KEY)
             llRequestPermissions(llAvatarOnSitTarget(),
                                 PERMISSION_TRIGGER_ANIMATION);
     }

     run_time_permissions(integer perm)
     {
         string anim = llGetInventoryName(INVENTORY_ANIMATION, 0);
         if (anim != "")
         {
             llStopAnimation("sit");
             llStopAnimation("sit_generic");
             llStopAnimation("sit_female");
             llStartAnimation(anim);
         }
     }
}



Hope that helps,

BlueWall


On 05/25/2012 06:51 AM, Dr Ramesh Ramloll wrote:
 > Hello,
 > I did not feel confident about stable solutions regarding how to get an
 > avie to sit properly on a mesh object after reading
 > 
http://opensim-dev.2196679.n2.nabble.com/Sit-position-changes-in-OpenSimulator-b6df9e9-Sat-5th-Nov-2011-td7056247.html
 >
 > dated nov 5 2011. I would like to hear from users who are sitting
 > perfectly fine in their opensim worlds ... how did you do it?
 > It's a little funny, I have transferred fairly complicated stuff into
 > opensim that work with some relief, and now I hit the sit target problem,
 > and I feel a little frustrated.
 > Any help deeply appreciated.
 > Regards
 > Ramesh
 >
 > --
 > 'Consider how the lilies grow. They do not labor or spin.'
 > *Rameshsharma Ramloll* PhD, CEO CTO DeepSemaphore LLC, Affiliate
 > /Research Associate Professor/, Idaho State University, Pocatello, ID
 > 83209 Tel: 208-240-0040
 > Blog <http://deepsemaphore.posterous.com/>, LinkedIn
 > <http://www.linkedin.com/in/rameshramloll>, DeepSemaphore LLC
 > <http://www.deepsemaphore.com>, Google+ profile
 > <https://plus.google.com/103652369558830540272/about>
 >
 >
 >
 > _______________________________________________
 > Opensim-users mailing list
 > Opensim-users at lists.berlios.de
 > https://lists.berlios.de/mailman/listinfo/opensim-users




More information about the Opensim-users mailing list