Jump to content

rotate and position a link movement relative to itself


Beowulf Zessinthal
 Share

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

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

Recommended Posts

 

vector pNormalStartPlace= <-0.132, 0.149, 0.277>;
rotation rNormalStartPlace= <0.50000, 0.50000, 0.50000, 0.50000>;
vector pGoForwardStandOnTip= <0.117, 0.149, 0.363>;
rotation rGoForwardStandOnTip= <0.707, 0.707, 0.0, 0.0>;
vector pToppleRight= <0.117, -0.013, 0.307>;
rotation rToppleRight= <-0.576, -0.576, -0.411, 0.411>;

default
{
    state_entry(){
    //this script goes inside the child prim of a two link box set.
    //first make demo shape..
    llSetLinkPrimitiveParamsFast(2,[
      PRIM_SIZE, <0.199,0.054,0.235>
    , PRIM_TYPE, PRIM_TYPE_BOX, PRIM_HOLE_DEFAULT, <0.0,1.0,0.0>, 0.0, ZERO_VECTOR, <0.20,1.0,0.0>, ZERO_VECTOR
    , PRIM_POS_LOCAL, <-0.13200, 0.14900, 0.27700>
    , PRIM_ROT_LOCAL, <0.50000, 0.50000, 0.50000, 0.50000>
    , PRIM_COLOR, ALL_SIDES, <1.0,0.0,0.502>, 1.0]);
    llOwnerSay("Touch to see the arrow prim 'go forward to stand on tip, then topple to the right'.\nBut then i want to use Edit to reposition the child prim, and touch again to see the prim do the same thing relative from its new start position. Is this possible? \n(ie: i want to apply the new start posrot to the old standard action data. I have done it with position, but the rotational offset is not applied in this example(!)");
    }
    
    touch_start(integer total_number){
    //now demo the arrow 'go forward to stand on tip, then topple to the right'
    vector pnew= llGetLocalPos();
    rotation rnew=  llGetLocalRot();
    vector pOffset= pNormalStartPlace-pnew;  llOwnerSay("pOffset= "+(string)pOffset);
    
    llSetLinkPrimitiveParamsFast(2 ,[PRIM_POS_LOCAL, pGoForwardStandOnTip- pOffset, PRIM_ROT_LOCAL, rGoForwardStandOnTip]);
    llSleep(0.5);
    llSetLinkPrimitiveParamsFast(2 ,[PRIM_POS_LOCAL, pToppleRight- pOffset, PRIM_ROT_LOCAL, rToppleRight]);
    llSleep(0.5);
    llSetLinkPrimitiveParamsFast(2 ,[PRIM_POS_LOCAL, pNormalStartPlace- pOffset, PRIM_ROT_LOCAL, rNormalStartPlace]);
    }
}

In this quandry i have two linked prims..

..and want a simple child prim action to occur relative to whatever its newly edited pos rot happens to be :)

I have the 'offset pos' part in the script but i know the 'offset rot' part will apply to both new positioning and new rotation somehow.

FYI the main prim in this demo is equivalent to/ represents an avatar, and the linked prim represents a worn object. I want the set of moves built into the object to be translatable wrt the attachment current pos and rot.

 

To use the script .. join two prims and drop the script attached into the Child prim)



 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 2743 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...