Draggable HUD elements
|
|
Beatfox Xevious
is THOUSANDS OF PEOPLE
Join date: 1 Jun 2004
Posts: 879
|
02-16-2006 22:44
Currently, mouse-dragging on objects and the llDetectedGrab function seem to be designed with only in-world objects in mind. I tried using these to create a draggable HUD element (a child prim that would repeatedly llSetPos based on llDetectedGrab values), and while I was able to get it to respond to mouse-dragging, the values were totally wrong. It soon became clear to me that llDetectedGrab was treating my actions as if I was dragging on an in-world object (through world coordinates) rather than a HUD object (through HUD coordinates).
In addition, my mouse cursor would always disappear during a HUD drag and, upon release, reappear at my av's origin. If I moved the mouse to the left or right, my view would start to rotate around my avatar. It seems as if the avatar mouse-drive behavior is activated if you try to drag on a touch-enabled HUD prim (which doesn't work correctly anyway, since the HUD isn't even in world-coordinate space).
Any chance HUD-dragging could get implemented correctly sometime in the not-too-distant-future? I'd love to start seeing sliders, knobs, and whatnot start appearing in HUDs.
_____________________
My Beatworks: Zephyr Chimes wind chimes, the KanaMaster Japanese kana tutor, and the FREE Invisibility Prim Public. Look for them at the Luskwood General Store in Lusk (144, 165).
"You have been frozen. You cannot move or chat. A pony will contact you via instant message (IM)." - mysterious system message I received after making off with Pony Linden
|
|
Shack Dougall
self become: Object new
Join date: 9 Aug 2004
Posts: 1,028
|
02-16-2006 23:12
I see where you're going with this and I agree in general, but I can't help but feel that a HUD is a 2D object and that LL really needs to deliver a 2D interface at some point.
It seems like we're jumping through hoops to make 2D GUI interfaces work in a 3D Havok environment.
I'm really just interested in the discussion. I don't have any clear thoughts.
_____________________
Prim Composer for 3dsMax -- complete offline builder for prims and sculpties in 3ds Max http://liferain.com/downloads/primcomposer/
Hierarchical Prim Archive (HPA) -- HPA is is a fully-documented, platform-independent specification for storing and transferring builds between Second Life-compatible platforms and tools. https://liferain.com/projects/hpa
|
|
Feynt Mistral
Registered User
Join date: 24 Sep 2005
Posts: 551
|
02-17-2006 00:37
This kind of HUD dragging will be needed if people want HUD attached browser windows when the uBrowser hits SL.
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
02-17-2006 04:50
From: Beatfox Xevious I'd love to start seeing sliders, knobs, and whatnot start appearing in HUDs. Has anyone had success with these things in world either? I tried making a slider thing but it didn't work at all well. Being able to constrain the motion of an object that is being grabbed would do it.
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
02-17-2006 08:26
You should divide by llGetRot(). It also returns a vector size that isn't very appropriate so you need llVecNorm too. To make it smooth, you may have to use more than one script.
|
|
Beatfox Xevious
is THOUSANDS OF PEOPLE
Join date: 1 Jun 2004
Posts: 879
|
02-17-2006 09:18
Zepp, are you responding to Seifert's post? I don't think that's the issue he's having. Sounds like he has it working except for constraints.
Seifert, did you use llDetectedGrab and llSetPos for your slider? You should be able to create constraints by clipping the values sent to llSetPos.
_____________________
My Beatworks: Zephyr Chimes wind chimes, the KanaMaster Japanese kana tutor, and the FREE Invisibility Prim Public. Look for them at the Luskwood General Store in Lusk (144, 165).
"You have been frozen. You cannot move or chat. A pony will contact you via instant message (IM)." - mysterious system message I received after making off with Pony Linden
|
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
02-17-2006 13:37
To constrain the motion a simple ifelse check should do. I've found this script to be useful as a basis for knobs. I've tried making knobs with llRotLookAt too, but seems like that doesn't work on attachments even though it works for normal nonphys prims.
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
02-17-2006 14:00
From: Beatfox Xevious Zepp, are you responding to Seifert's post? I don't think that's the issue he's having. Sounds like he has it working except for constraints.
Seifert, did you use llDetectedGrab and llSetPos for your slider? You should be able to create constraints by clipping the values sent to llSetPos. Yeah I mean it works, as in the user drags the slider prim up, then it jumps as setpos projects the new position to what my constraints say it should be. It doesn't feel like a slider should feel though, because the constraints are implemented by jerking back to the line rather than the movement only being in that direction. I wasn't using llDetectedGrab - it wasn't giving me any information (this may have been because I needed to set physics or something), and even if it did, what I need to know is if it moves and where it is, and moving_start() is enough for that.
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
02-17-2006 14:06
From: Seifert Surface Yeah I mean it works, as in the user drags the slider prim up, then it jumps as setpos projects the new position to what my constraints say it should be. It doesn't feel like a slider should feel though, because the constraints are implemented by jerking back to the line rather than the movement only being in that direction. Drag it up via the building tools? From: Seifert Surface I wasn't using llDetectedGrab - it wasn't giving me any information (this may have been because I needed to set physics or something), and even if it did, what I need to know is if it moves and where it is, and moving_start() is enough for that.
Until recently, llDetectedGrab didn't work without physics, except for a hack with linking to a physical prim. It does work on nonphysical prims now however. What I've done on some HUDs is use vector grab = llVecNorm(llDetectedGrab(0) / llGetRot()) and then do a few ifelse checks to constrain the motion, it works for sliders and knobs but has all the common problems of making nonphysical motion look good.
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
02-17-2006 15:06
From: Zepp Zaftig Drag it up via the building tools? Yes, that would work, and I've done projects for which the control mechanism uses the build tools (rotating an arrow object for aiming). For a slider on, say, an elevator control, one would want it to be as intuitive as possible to use. Going to building tools isn't intuitive enough for my purpose. Currently buttons to push are intuitive enough for someone with no experience of the object to come along and work it. Unfortunately they're too primmy at the moment. From: Zepp Zaftig Until recently, llDetectedGrab didn't work without physics, except for a hack with linking to a physical prim. It does work on nonphysical prims now however. What I've done on some HUDs is use vector grab = llVecNorm(llDetectedGrab(0) / llGetRot()) and then do a few ifelse checks to constrain the motion, it works for sliders and knobs but has all the common problems of making nonphysical motion look good. llDetectedGrab returns the direction something is being pulled in right? I can't see how this information alone is useful beyond a binary switch thing, or something you can slide, but only one notch at a time?
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Beatfox Xevious
is THOUSANDS OF PEOPLE
Join date: 1 Jun 2004
Posts: 879
|
02-17-2006 16:24
From: Zepp Zaftig Until recently, llDetectedGrab didn't work without physics, except for a hack with linking to a physical prim. It does work on nonphysical prims now however. What I've done on some HUDs is use vector grab = llVecNorm(llDetectedGrab(0) / llGetRot()) and then do a few ifelse checks to constrain the motion, it works for sliders and knobs but has all the common problems of making nonphysical motion look good. Ah, I see what you were saying earlier now. So you actually got sliders, etc. to work on a HUD? When I was messing around with it, it seemed like the behavior changed based on the camera angle, but maybe it was just the direction the avatar was facing... Heh. I just checked llDetectedGrab on the Wiki again and noticed something at the bottom that I'd missed before. Apparently, it is affected by camera angle. So your method will work when the camera is at its default position behind the avatar, but will malfunction if the user moves their camera around.
_____________________
My Beatworks: Zephyr Chimes wind chimes, the KanaMaster Japanese kana tutor, and the FREE Invisibility Prim Public. Look for them at the Luskwood General Store in Lusk (144, 165).
"You have been frozen. You cannot move or chat. A pony will contact you via instant message (IM)." - mysterious system message I received after making off with Pony Linden
|
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
02-17-2006 17:53
From: Beatfox Xevious Ah, I see what you were saying earlier now. So you actually got sliders, etc. to work on a HUD? When I was messing around with it, it seemed like the behavior changed based on the camera angle, but maybe it was just the direction the avatar was facing...
Heh. I just checked llDetectedGrab on the Wiki again and noticed something at the bottom that I'd missed before. Apparently, it is affected by camera angle. So your method will work when the camera is at its default position behind the avatar, but will malfunction if the user moves their camera around. Yeah, kinda. If I only check for movement in one direction at once it does return some usable values. Sometimes, but not always, when I start dragging the first value I get is just weird, while the rest are fine. I think I may have seen a solution to that problem once in the forums, but some Linden have destroyed forum search(i.e. disabled searching for functions, like lldetectedgrab) so I can't find it anymore. Anyway a slider or knob that checks for grab in the y direction works. I hadn't tried moving the camera up and down while wearing it before, but doing that I noticed it stops working. Maybe it would be possible to make that work better with llGetCameraRot somehow. It still works when I move around though. But as you said earlier, it will turn the avatar around.
|
|
Beatfox Xevious
is THOUSANDS OF PEOPLE
Join date: 1 Jun 2004
Posts: 879
|
02-17-2006 17:56
From: Zepp Zaftig Maybe it would be possible to make that work better with llGetCameraRot somehow. I was wondering about that myself. 
_____________________
My Beatworks: Zephyr Chimes wind chimes, the KanaMaster Japanese kana tutor, and the FREE Invisibility Prim Public. Look for them at the Luskwood General Store in Lusk (144, 165).
"You have been frozen. You cannot move or chat. A pony will contact you via instant message (IM)." - mysterious system message I received after making off with Pony Linden
|
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
02-17-2006 18:07
From: Seifert Surface llDetectedGrab returns the direction something is being pulled in right? I can't see how this information alone is useful beyond a binary switch thing, or something you can slide, but only one notch at a time?
If you put it in the event touch(integer tn) it will continously return the direction it is being dragged. This for example rotates a cylinder on the ground. default { state_entry() { llSetStatus(STATUS_BLOCK_GRAB, TRUE); } touch(integer num) { vector grab = llDetectedGrab(0); if(grab.x < 0) { llRotLookAt(llEuler2Rot(<0,0,PI / 10.0>) * llGetRot(),0.3,0.3); } else if(grab.x > 0) { llRotLookAt(llEuler2Rot(<0,0,-PI / 10.0>) * llGetRot(),0.3,0.3); } } }
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
02-17-2006 20:42
Wow, that's really cool. I hadn't realised that you could get information about the direction of the "drag" when you don't actually drag it.
It's a shame that it doesn't know if you're pulling the top or bottom of the "knob", or from which direction you're looking at it. Maybe covering up half of the knob could make that intuitive.
Hmm... this gives me an idea...
(Edit: the delay on llOffsetTexture kills that idea...)
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|
|
Zepp Zaftig
Unregistered Abuser
Join date: 20 Mar 2005
Posts: 470
|
02-17-2006 21:15
From: Seifert Surface Wow, that's really cool. I hadn't realised that you could get information about the direction of the "drag" when you don't actually drag it.
It's a shame that it doesn't know if you're pulling the top or bottom of the "knob", or from which direction you're looking at it. Maybe covering up half of the knob could make that intuitive.
Hmm... this gives me an idea...
(Edit: the delay on llOffsetTexture kills that idea...) It can know what direction you're looking at it, that's what llGetCameraPos and llGetCameraRot are for.
|
|
Seifert Surface
Mathematician
Join date: 14 Jun 2005
Posts: 912
|
02-17-2006 21:28
From: Zepp Zaftig It can know what direction you're looking at it, that's what llGetCameraPos and llGetCameraRot are for. Ah, yes. What we can't get at is what bit of the prim the user grabbed. I guess it shouldn't be too hard to design around that issue.
_____________________
-Seifert Surface 2G!tGLf 2nLt9cG
|