Jump to content
  • 0

Any Idea how to create or add UI controls in Second Life ?


raj441977
 Share

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

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

Question

6 answers to this question

Recommended Posts

  • 1
1 hour ago, Wulfie Reanimator said:

This is done with scripts.

Generally speaking, the script would use the touch_start event to figure out which part of the user is trying to interact with and the touch event to figure out where the user is dragging.

In addition to this, look into llDetectedTouchUV(), which is what I have used in the past to create color pickers, sliders, and other draggable controls (like a dimmer for a light source).
The example scripts on that wiki page are pretty good as a starting point, especially the second one looks like it could make a nice basis for you, although you should change the touch_start event to a simple touch event, and whilst you're at it, use llSetText instead of llSay so as to cut down on chat spam. 🙂 

  • Like 3
Link to comment
Share on other sites

  • 1

Okay, I'm back for a moment with a little more info, now that I have re-read the original post, which I now understand is not about the scripting, but about HOW TO BUILD it...

You will need two layers. I call them the touch layer, and the background layer.

  • The background layer will have - for example - the texture of the color gradient.
  • The touch layer has the draggable UI controls, which are drawn on a transparent background. This texture is then placed on a prim which I call the touch layer.
  • The touch layer is then placed on top of the background layer so that it matches up with the background layer.
  • Using llDetectedTouchUV() you detect where the prim was touched, this returns a vector between <0,0,0> and <1,1,0>.
  • Use this vector to adjust the offset of the texture on the touch layer. This effectively makes it look like the UI item follows the mouse.

I hope this helps. I can't go in world at the moment, so I can't whip you up some example code, so I hope this will get you on your way. Note that it may be a good idea to have your script retrieve the link number of the touch layer, so you can do if(llDetectedLinkNumber(0) != touch_layer) return; so as to prevent other links to respond to that touch.

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

  • 0

This is done with scripts.

Generally speaking, the script would use the touch_start event to figure out which part of the user is trying to interact with and the touch event to figure out where the user is dragging.

The specific details about the code are very dependent on how the HUD was built. If you don't know how to write LSL scripts, you should post in the Wanted or Inworld Employment sections.

  • Like 2
Link to comment
Share on other sites

  • 0

adding to what Fritigern says about using textured layers. When we add a 3rd layer then we can make 3D control buttons. Popped up when the button is not pressed, Popped down when it is

on touch_start.  Bring the 3rd layer (our popped down layer) to the front

on touch_end.  Bring the 2nd layer (our popped up layer) to the front

  • Like 1
Link to comment
Share on other sites

  • 0

Sorry, I was not able to focus on my needs, actually I am not asking for LSL scripting or the touch detection matters or color generating, My need is the UI "Drag-able Slider", not the the code of it's interactions..... I tried lots, searched lots, but not able to build the drag-able content in SL (Just like Range Slider in HTML)

Link to comment
Share on other sites

  • 0
On 1/13/2020 at 3:09 AM, Fritigern Gothly said:

Okay, I'm back for a moment with a little more info, now that I have re-read the original post, which I now understand is not about the scripting, but about HOW TO BUILD it...

You will need two layers. I call them the touch layer, and the background layer.

  • The background layer will have - for example - the texture of the color gradient.
  • The touch layer has the draggable UI controls, which are drawn on a transparent background. This texture is then placed on a prim which I call the touch layer.
  • The touch layer is then placed on top of the background layer so that it matches up with the background layer.
  • Using llDetectedTouchUV() you detect where the prim was touched, this returns a vector between <0,0,0> and <1,1,0>.
  • Use this vector to adjust the offset of the texture on the touch layer. This effectively makes it look like the UI item follows the mouse.

I hope this helps. I can't go in world at the moment, so I can't whip you up some example code, so I hope this will get you on your way. Note that it may be a good idea to have your script retrieve the link number of the touch layer, so you can do if(llDetectedLinkNumber(0) != touch_layer) return; so as to prevent other links to respond to that touch.

ah, I got that, thanks...... I think I got the answer, probably this is what I wanted for... thank you very much

  • Like 1
Link to comment
Share on other sites

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