Jump to content

Help with popup 90 degree rotating prim


Fubar Constantine
 Share

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

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

Recommended Posts

I have recently wrote a script that almost does what I want except I want it to rotate from the bottom of the prim not the middle like it does

Ideally I want a prim of a person ghost etc laying flat on the land then when it heres a word in local it pops up making itself visible

I have the listening part working

it rotates and resets but its rotating from the centre not the bottom

any help would be greatly appreciated

 

integer listenHandle;

stop_listen_handle()
{
    llListenControl(listenHandle, FALSE);           
}
 
default
{
    state_entry()
    {
        listenHandle = llListen(0, "", NULL_KEY, "Phen");
    }
 
    listen(integer channel, string name, key id, string message)
    {
        //llOwnerSay("beep");
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION, llEuler2Rot(<0.0,PI/2,0.0>)*llGetRot()]);
        //llSetRot(llEuler2Rot(<0.0,PI/2,0.0>) * llGetRot());
//      stop listening until script is reset
        llSetTimerEvent(5); //timer event 10 seconds
        stop_listen_handle();
    }
 
 timer()
    {
        llSetLinkPrimitiveParamsFast(LINK_THIS,[PRIM_ROTATION, llEuler2Rot(<0.0,-PI/2,0.0>)*llGetRot()]);
        //llSetRot(llEuler2Rot(<0.0,PI/2,0.0>) * llGetRot());
         llListenControl(listenHandle, TRUE);           
         llSetTimerEvent(0.0);
   }

    on_rez(integer start_param)
    {
        llResetScript();
    }
 
    changed(integer change)
    {
        if (change & CHANGED_OWNER)
        {
            llResetScript();
        }
    }
}

 

 

Link to comment
Share on other sites

I think for something like this, unless there's a strong reason not to, I would simply put the script in invisible prim at the base of the object, properly aligned, and make that the root prim.

Certainly it's possible to offset the rotation point, as outlined in the thread to which Ruthven links, but I try to avoid doing it unless I have to, just because I like to keep things simple when I can.

  • Like 1
Link to comment
Share on other sites

Thanks I ended up with this that does what I wanted

Type BOO in local and the prim rotates from flat on the ground to upright

after 5 seconds it goes back

integer listenHandle;
integer intSwing =90;
rotation rotSwing;
vector vOffset;
list l;
vector v;
rotation r;
default
{
    state_entry()
    {
        listenHandle = llListen(0, "", NULL_KEY, "BOO");
        rotSwing = llEuler2Rot(<0.0,(float)intSwing*DEG_TO_RAD,0.0>);
        vector size = llGetScale();      
        vOffset = <(size.x*-0.5),(size.y*-0.5),(size.z*-0.5)>;
    }
 
    listen(integer channel, string name, key id, string message)
    {
        l = llGetPrimitiveParams([PRIM_POS_LOCAL,PRIM_ROT_LOCAL]);
        v = llList2Vector(l,0);
        r = llList2Rot(l,1);
        llSetPrimitiveParams([PRIM_POS_LOCAL,v+(vOffset-vOffset * rotSwing)*r,PRIM_ROT_LOCAL,rotSwing*r]);
           
        rotSwing.s*=-1;            
        llSetTimerEvent(5); //timer event 10 seconds
         llListenControl(listenHandle, FALSE);   
    }
 
 timer()
    {
        rotSwing = llEuler2Rot(<0.0,(float)360*DEG_TO_RAD,0.0>);
        llSetPrimitiveParams([PRIM_POS_LOCAL,v+(vOffset-vOffset * rotSwing)*r,PRIM_ROT_LOCAL,rotSwing*r]);
        llListenControl(listenHandle, TRUE);           
        llSetTimerEvent(0.0);
        llResetScript();
   }
    on_rez(integer start_param)
    {
        llResetScript();
    }
}
Link to comment
Share on other sites

6 hours ago, Innula Zenovka said:

I think for something like this, unless there's a strong reason not to, I would simply put the script in invisible prim at the base of the object, properly aligned, and make that the root prim.

Certainly it's possible to offset the rotation point, as outlined in the thread to which Ruthven links, but I try to avoid doing it unless I have to, just because I like to keep things simple when I can.

The other possible solution -- also a lot easier than calculating the offset -- is to put your texture on a prim that's twice the height you want it to end up, and then slice it to make the bottom half vanish.  It will still rotate around the middle, but the middle of the sliced prim will now be its visible bottom edge.

Edited by Rolig Loon
typo
  • Like 1
Link to comment
Share on other sites

Thanks Rolig that also gave me an idea for a different invisible scary prim

This one also works well but best to place any texture and prim placement 

before adding the scripts as it rezzes invisible

 

//This Script is designed to start with an invisible prim
//once it hears BOO anywhere in local in any case it makes itself visible
integer listenHandle;
default
{
    state_entry()
    {
        //set a listener handle
        listenHandle = llListen(0, "", NULL_KEY, "");
    }
 
    listen(integer channel, string name, key id, string message)
    {
       //search the string from start to finish for BOO within string
        if(llSubStringIndex(llToUpper(message), llToUpper("BOO")) !=-1) 
        {
            // opaque
            llSetLinkAlpha(LINK_SET, 1.0, ALL_SIDES);
            llSay(0, "I scare you" ); //name of object says I scare you
            llSetTimerEvent(5); //timer event 5 seconds
            llListenControl(listenHandle, FALSE);   
        }
    }       
    
 
 timer()
    {
        // transparent
        llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);
        llListenControl(listenHandle, TRUE);           
        llSetTimerEvent(0.0);
        llResetScript();
   }
    on_rez(integer start_param)
    {
        llSetLinkAlpha(LINK_SET, 0.0, ALL_SIDES);   
        llResetScript();
    }
}
Link to comment
Share on other sites

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