Jump to content
Athayus Quan

HUD Script Minimize Rotate Button thingy

Recommended Posts

I'm trying to sort out how to make an object where I have mesh hud I've made and I want to be able to click the side of the hud to have it minimize to a smaller button and back again. I'm assuming I'd have to make the mesh rotate 90 degrees on screen or similar so it shows the button. And if clicked again rotates back to my hud / mesh object. I'm more a web programmer but my LSL sucks. Can anyone point me in the right direction for that? Basically I'd like a minimize button for my hud. 

Cheers for any help. 

Share this post


Link to post
Share on other sites

A HUD attaches by default with its +X axis pointing "forward" relative to your avatar.  That is, you are looking at the negative end of its X axis (face 4 on a prim cube).  To rotate it, just llSetRot(llEuler2Rot(<0.0,0.0,PI/2>)) or whatever your favorite 90 degree rotation is.  To recover, llSetRot(llEuler2Rot(<0.0,0.0,0.0>));

You might find this wiki page helpful >>> http://wiki.secondlife.com/wiki/Creating_HUDs

Edited by Rolig Loon

Share this post


Link to post
Share on other sites

thank you will try that. I wanted something kinda like how the catwa hud or signature hud minimizes when clicking the button to a circle then back again for similar functionality 

Share this post


Link to post
Share on other sites

One way might be to move the body of the HUD off-screen. Another could be to shrink all the components of the body and hide them behind the control button. Moving the body, you'd likely want to first move the whole thing, and then move the button to the screen position you want. Or locate the button and the body far enough apart that only one of them is visible on the screen. Shrinking and hiding would require maintaining a list of the position and size of all the individual components.

Using rotation, I think you'd need to use mesh objects that are planes so that when they're rotated to face away from the user they don't present transparent faces that can interfere with clicks. I seem to remember having an issue with this once: I'm not sure it's a good idea to take up screen space with invisible HUD objects.

You'll also want to consider how far you're able to accommodate individual user's preferences for where they want to put the button on their screen, and where the body of the HUD goes in relation to that button.

Anyhow, you may want to look at llSetLinkPrimitiveParamsFast to get an idea of how to manipulate linked prims en masse.

As for the HUD itself, you may want to use multiple prims (one advantage being the prims can be set independently to show the touch cursor), a single prim whose script uses llDetectedTouchUV to determine where it's been clicked, or a custom mesh with appropriately positioned faces for display areas or buttons. Or, most likely, a combination of these.

 

 

 

Edited by KT Kingsley

Share this post


Link to post
Share on other sites
1 hour ago, KT Kingsley said:

Using rotation, I think you'd need to use mesh objects that are planes so that when they're rotated to face away from the user they don't present transparent faces that can interfere with clicks. I seem to remember having an issue with this once: I'm not sure it's a good idea to take up screen space with invisible HUD objects.

   I made a map HUD for organized mermaid swims. It would update itself as the user traveled through the planned course. As in the method @KT Kingsley describes, it was mesh and I designed it so that it had no faces on the back side, save for a small button to restore it. When it was minimized (rotated), you could click or grab camera focus on any object in the screen space occupied by the HUD, just as if it wasn't even there, as long as you didn't touch the restore button. It's a fast and easy way to get it out of the way when you need more of your screen.

Edited by Ivanova Shostakovich
because one little mistake.
  • Thanks 1

Share this post


Link to post
Share on other sites

at the moment I'm using a clothing resize script I have to allow people to size it on the screen but I want it to to still be usable while hidden and play sound via shared media. So I though rotate to smaller object would prob work the best. The hud its self is actually mesh object with a prim for screen. Then I wanted to add a linked prim or circle mesh object flat for the minimized button to fit on screen. I'd like it where touching the side of the mesh object would activate rotate then, when its on the small button click that to return back to the mesh object I've made for my hud. So basically touch side of mesh object have it rotate to smaller object for illusion persay of being smaller but still any data on the mesh object to still be able to play even if out of view persay. 

Share this post


Link to post
Share on other sites

Athayus, if by shared media you mean media-on-a-prim, you may want to rethink this, as not everyone (meaning a lot of potential customers) has media enabled. if you want to play sounds then best to use llTriggerSound()

edit add wiki link: http://wiki.secondlife.com/wiki/LlTriggerSound

 

Edited by Mollymews

Share this post


Link to post
Share on other sites
47 minutes ago, Mollymews said:

Athayus, if by shared media you mean media-on-a-prim, you may want to rethink this, as not everyone (meaning a lot of potential customers) has media enabled. if you want to play sounds then best to use llTriggerSound()

edit add wiki link: http://wiki.secondlife.com/wiki/LlTriggerSound

It's hard to make that suggestion when we don't know what other features are used through the media.

Besides, llPlaySound would probably be preferable over llTriggerSound, as PlaySound won't be heard by other people if it's used in a HUD.

Edited by Wulfie Reanimator

Share this post


Link to post
Share on other sites

What I do is shrink and expand (for the different modes) the hud, apply a new texture, and redefine the interpretation of the UV coordinates.

UV coordinates: http://wiki.secondlife.com/wiki/LlDetectedTouchUV

For shrink/expand and retexture, I use one of the varieties of llSetLinkPrimitiveParamsFast() and do it all in one shot. http://wiki.secondlife.com/wiki/LlSetPrimitiveParams#llSetLinkPrimitiveParamsFast

Edited by Erwin Solo
Embellished

Share this post


Link to post
Share on other sites

That's a question of geometry.

I make a prim root and use it as show/hide button and link the hud to it. Then perform a 180° rotation so the hud is rotated off screen.
If you make the backside of the hud the same as the front side you can use this construct for left and right margin.
Can be constructed for top and bottom margin the same way.

For sliding get the size with llGetScale and move the exact width/height into the right direction and back. In this case you want the show/hide button connected to the side of the hud so it will stay on screen.

 

Edited by Nova Convair

Share this post


Link to post
Share on other sites

I'd just like to be able to make a hud mesh for the main object and a small button for the minimize button so that when I click on the mesh object side it minimizes to a smaller button. Aka by rotating the object to the side 90 degree's then if you click it again it rotates the object's back to the front view. I can't seem to find any information or code that can do this. The information above while I appreciate the help doesn't really show or help with that. I'm more than willing to pay for some open source script I can drop into two prims aka the mesh object and minize button. Just something simple. My LSL sucks for coding so posting commands doesn't help cause I need to be able to see the whole script on how it would work so I can make the project I'm working on work. I can handle layout and objects just need a function script.

Edited by Athayus Quan

Share this post


Link to post
Share on other sites

If you're looking to find an existing script or to commission someone to write a script, the places to post are the Wanted forum or the InWorld Employment forum.  This Scripting forum is really a gathering place for scripters who want to share ideas or moan about things that aren't working quite the way they they expected. You can also look in script libraries in world or on line, but be wary of quality.  You are not likely to find a generic script for the job you have in mind, but most scripters you contact should be able to write a custom script to match your mesh HUD.

Share this post


Link to post
Share on other sites
3 hours ago, Athayus Quan said:

I'd just like to be able to make a hud mesh for the main object and a small button for the minimize button so that when I click on the mesh object side it minimizes to a smaller button. Aka by rotating the object to the side 90 degree's then if you click it again it rotates the object's back to the front view. I can't seem to find any information or code that can do this. The information above while I appreciate the help doesn't really show or help with that.

Okay but literally:

On 10/9/2019 at 12:07 AM, Rolig Loon said:

To rotate it, just llSetRot(llEuler2Rot(<0.0,0.0,PI/2>)) or whatever your favorite 90 degree rotation is.  To recover, llSetRot(llEuler2Rot(<0.0,0.0,0.0>));

All you need is llSetRot to change the HUD's rotation. llEuler2Rot is there to just make things more "human-readable."
This is also exactly what the Catwa HUDs do, since that's what you gave as an example.

Share this post


Link to post
Share on other sites

Thanks wulfie will try and. I take it there is code to add for on touch object or prim as well and or something to put in each linked prim to tell on touch to rotate one way or the other? Again am new to coding LSL from scratch. 

Share this post


Link to post
Share on other sites

Rotations themselves can be a real bear, but coding them is relatively easy.  If you are dealing with an object that has no child prims, you use llSetRot, as I did above ^^.  If you are dealing with child prims, you can rotate them individually with a single script in the root prim.  To do that, you need to use llSetLinkPrimitiveParamsFast, for which the syntax is

llSetLinkPrimitiveParamsFast(iLink_number, [PRIM_ROT_LOCAL, <your_rotation_goes_here>]);

where you are providing a local rotation, relative to the root prim, for that specific link.  You can list as many separate SLPPF statements as you have child prims.  If you want to rotate the entire linkset, you can just use llSetRot or you can write

llSetLinkPrimitiveParamsFast(LINK_THIS, [PRIM_ROTATION, <your_rotation_goes_here>]);

The SLPPF function is capable of doing a lot of different things -- it's sort of like a Swiss Army knife -- so it can get very hairy looking if you want to make a linkset do a whale of a lot of things at once.  If you look at the syntax in the wiki without taking a deep breath first, you can easily be intimidated.  Still, for this simple task, it's fairly straightforward.

Figuring out what the rotation ought to be, on the other hand ..... 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...