Tattooshop Posted June 18, 2020 Share Posted June 18, 2020 (edited) 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 June 18, 2020 by Tattooshop Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 18, 2020 Share Posted June 18, 2020 2 minutes ago, Tattooshop said: How to make that these buttons do not rotate with the HUD? ❤️ 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. 1 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 18, 2020 Author Share Posted June 18, 2020 (edited) 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? ( new idea lol ) Edited June 18, 2020 by Tattooshop Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 18, 2020 Share Posted June 18, 2020 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. 1 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 19, 2020 Author Share Posted June 19, 2020 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)); } } } } Link to comment Share on other sites More sharing options...
Tattooshop Posted June 19, 2020 Author Share Posted June 19, 2020 Well I made it that way 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 More sharing options...
Rolig Loon Posted June 19, 2020 Share Posted June 19, 2020 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. 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted June 19, 2020 Author Share Posted June 19, 2020 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 More sharing options...
Xiija Posted June 21, 2020 Share Posted June 21, 2020 (edited) Something to test with ... 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 June 21, 2020 by Xiija 1 1 Link to comment Share on other sites More sharing options...
Tattooshop Posted July 25, 2020 Author Share Posted July 25, 2020 (edited) On 6/21/2020 at 4:57 PM, Xiija said: Something to test with ... Thank you very much! ( Just saw your post ). This is so neat! Edited July 25, 2020 by Tattooshop 1 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