Jump to content

HUD parts rotations


Tattooshop
 Share

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

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

Recommended Posts

Hey. I'm trying to create a cubic HUD with several buttons. Each side of the cube is a HUD's page. There are several buttons on each page. But there are 4 buttons that should always be visible to switch the HUD pages. How to make that these buttons do not rotate with the HUD? :)❤️

HUD is prim.

 

Edited by Tattooshop
Link to comment
Share on other sites

59 minutes ago, Rolig Loon said:

Put those buttons on the HUD's root prim and then rotate only the child prim with all the rest of the buttons on it.

Thank you so much! Unfortunately HUD made of prims, mesh would make it easier of course. :)

 

But is it possible to make these buttons rotate too, but each time in the same certain position? How to "fix" them to get back to that point? :D ( new idea lol )

 

Edited by Tattooshop
Link to comment
Share on other sites

I can't quite visualize your HUD, but you really only need two prims total:  the non-rotating root prim and the rotating child prim that displays all of the control buttons. To rotate the child prim, all you need to do is write your script's touch_start event to include

rotation CurrentRot = (rotation)llList2String(llGetLinkPrimitiveParams(child_prim_number,[PRIM_ROT_LOCAL]),0);

llSetLinkPrimitiveParamsFast(child_prim_number,[PRIM_ROT_LOCAL, CurrentRot * llEuler2Rot(<0.0,0.0,PI/2>)]);

Each time you click on the HUD, it should rotate the child prim 90 degrees around its Z axis.  You will of course want to use a specific button on the root prim as the trigger for that touch action.

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

12 hours ago, Rolig Loon said:

I can't quite visualize your HUD, but you really only need two prims total:  the non-rotating root prim and the rotating child prim that displays all of the control buttons. To rotate the child prim, all you need to do is write your script's touch_start event to include

rotation CurrentRot = (rotation)llList2String(llGetLinkPrimitiveParams(child_prim_number,[PRIM_ROT_LOCAL]),0);

llSetLinkPrimitiveParamsFast(child_prim_number,[PRIM_ROT_LOCAL, CurrentRot * llEuler2Rot(<0.0,0.0,PI/2>)]);

Each time you click on the HUD, it should rotate the child prim 90 degrees around its Z axis.  You will of course want to use a specific button on the root prim as the trigger for that touch action.

Thank you again! So I decided to try to reduce the number of buttons to two Prev. and Next on each page. that’s what the HUD looks like now. 4 sides of cube and on each there are buttons. but strange. when it is rezzed everything rotates perfectly. but as soon as I wear it as a HUD it starts to work incorrectly. where is the mistake? :)

default
{
    state_entry()
    {

    }

    touch_start(integer total_number)
    {

        string button = llGetLinkName(llDetectedLinkNumber(0));

        if (llDetectedKey(0) != llGetOwner()) return;
        {
            if (button == "prev")
            {
                llSetRot(llGetRot() * llEuler2Rot( < 0, 0, -90 > * DEG_TO_RAD));
            }
            else if (button == "next")
            {
                llSetRot(llGetRot() * llEuler2Rot( < 0, 0, 90 > * DEG_TO_RAD));
            }
        }
    }
}

 

Snapshot_001.png

Link to comment
Share on other sites

Well I made it that way :P

default
{
    state_entry()
    {

    }

    touch_start(integer total_number)
    {

        string button = llGetLinkName(llDetectedLinkNumber(0));

        if (llDetectedKey(0) != llGetOwner()) return;
        {
            /* PREV BUTTONS */
            if (button == "prev1")
            {
                llSetRot(llEuler2Rot( < 0, 0, -90 > * DEG_TO_RAD));
            }
            else if (button == "prev2")
            {
                llSetRot(llEuler2Rot( < 0, 0, -180 > * DEG_TO_RAD));
            }
            else if (button == "prev3")
            {
                llSetRot(llEuler2Rot( < 0, 0, -270 > * DEG_TO_RAD));
            }
            else if (button == "prev4")
            {
                llSetRot(llEuler2Rot( < 0, 0, 0 > * DEG_TO_RAD));
            }
            
            /* NEXT BUTTONS */            
            else if (button == "next1")
            {
                llSetRot(llEuler2Rot( < 0, 0, 90 > * DEG_TO_RAD));
            }
            else if (button == "next2")
            {
                llSetRot(llEuler2Rot( < 0, 0, 0 > * DEG_TO_RAD));
            }
            else if (button == "next3")
            {
                llSetRot(llEuler2Rot( < 0, 0, 270 > * DEG_TO_RAD));
            }
            else if (button == "next4")
            {
                llSetRot(llEuler2Rot( < 0, 0, 180 > * DEG_TO_RAD));
            }
        }
    }
}

 

Link to comment
Share on other sites

It looks like there are two mistakes.  One is that you are using regional rotations instead of local ones, as I suggested in my brief note.  The other is that it looks like you are using a flock of separate prims to make the individual buttons instead of using touch-sensitive areas (with llDetectedTouch functions) on a single prim for the buttons. Doing it your way means that you have more components to move -- a much more complicated scripting job.  

  • Thanks 1
Link to comment
Share on other sites

5 hours ago, Rolig Loon said:

It looks like there are two mistakes.  One is that you are using regional rotations instead of local ones, as I suggested in my brief note.  The other is that it looks like you are using a flock of separate prims to make the individual buttons instead of using touch-sensitive areas (with llDetectedTouch functions) on a single prim for the buttons. Doing it your way means that you have more components to move -- a much more complicated scripting job.  

Yes llDetectedTouch and touch-sensitive areas I definitely need to learn! Thank you so much! :)

 

Link to comment
Share on other sites

Something to test with ...

0aee572faeabc9df17e87a8c66d59b83.png

 

integer numberOfColumns = 3;
integer numberOfRows = 3;
default
{
    state_entry()
    {  
    }
    touch_start(integer num_detected)
    {      
        key id = llDetectedKey(0);             
        key owner = llGetOwner();  
        integer face = llDetectedTouchFace(0); 
        vector touchST = llDetectedTouchST(0); 
      
        integer currentCellNumber = llFloor( touchST.x * numberOfColumns ) +
             ( numberOfRows - llCeil( touchST.y * numberOfRows ) ) * numberOfColumns + 1; 
        llOwnerSay("cell number: " + (string)currentCellNumber );  
    }   
}

 

Edited by Xiija
  • Like 1
  • Thanks 1
Link to comment
Share on other sites

  • 1 month later...
You are about to reply to a thread that has been inactive for 1426 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...