Jump to content

Moving prim as attachment


Casandra Kumsung
 Share

You are about to reply to a thread that has been inactive for 4785 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

I have a tongue that I want to move out then in the mouth. It is two prims, (not sure the second is necessary)

here is the scripts, the menu was to test it.

It works on the ground, If I rotate it it works but when worn it goes out in one direction and in in another.  My guess is somehow I need to keep vector coordinates referenced to the first prim.  As  I said it works on the ground when I move it but as a attachment does not.

Kind of wonder if this is possible now.

 

integer dialog_channel= 424; // set a dialog channel
// list menu = [ "Out", "In"];

vector startPosition;
float groundLevel;
 
vector gVecLocalOffset2 = <0.0, 0.0, 0.0>;
integer flag ;

                                  
vector vPosChild2 = <0.0, 0.0, 0.0>;

float displacement = 0;
    
Out()
   {
 
       gVecLocalOffset2 = <-displacement, 0.0, 0.0>;
       vPosChild2 = ((vector)((string)llGetLinkPrimitiveParams( 2, [PRIM_POSITION] )) - llGetPos()) / llGetLocalRot();
     llSetLinkPrimitiveParamsFast( 2, [PRIM_POSITION, vPosChild2 - (gVecLocalOffset2 = gVecLocalOffset2 * -1)] );
      
    }
 
    
In()
{
 gVecLocalOffset2 = <displacement, 0.0, 0.0>;
 
 vPosChild2 = ((vector)((string)llGetLinkPrimitiveParams( 2, [PRIM_POSITION] )) - llGetPos()) / llGetLocalRot();
     
 llSetLinkPrimitiveParamsFast( 2, [PRIM_POSITION, vPosChild2 - (gVecLocalOffset2 = gVecLocalOffset2 * -1)] );

}

                                                            
default
{   // #1  Default
    state_entry()
    {
   llListen( dialog_channel, "", NULL_KEY, "");
 
 // startPosition = llGetPos();
  //      groundLevel = llGround( startPosition );
    }
    
//    touch_start(integer total_number)
//    {
 //       llDialog( llDetectedKey( 0 ), "What do you want to do?", menu,
 //                dialog_channel );
  //  }
    
    
    listen(integer channel, string name, key id, string choice )
    {   
    
        vector position = llGetPos();
                  
    //    if ( llListFindList( menu, [ choice ]) != -1 )  
  //            {
      
            
            if (choice == "In")
                // Begin If B
                {
                // set the texture
                  displacement = .2;
               Out();
                 }
                 

              else if( choice == "Out")
                    
                 {
                     displacement = .2;
                     In();
                 }
                 
        
              
            else
      
             {
              llSay( 0, "Invalid choice: " + choice );
             }   
  //    }
        } // end Listen # 2
            
   
   
    
    }   // end default
    

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 4785 days.

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
 Share

×
×
  • Create New...