Casandra Kumsung Posted March 31, 2011 Share Posted March 31, 2011 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 More sharing options...
Rolig Loon Posted March 31, 2011 Share Posted March 31, 2011 You need to get the prim's local rotation with llGetLinkPrimitiveParams(prim_no,[PRIM_ROT_LOCAL]) and use that to set the prim's new rotation .... llSetLinkPrimitiveParamsFast(prim_no, [PRIM_ROT_LOCAL, local_rot/llGetRot()]); Link to comment Share on other sites More sharing options...
Casandra Kumsung Posted April 1, 2011 Author Share Posted April 1, 2011 Thanks forgot about rotation, heads and bodys do rotate! 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