Jump to content

Touch detection for worn rigged mesh: what have I missed?


arabellajones
 Share

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

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

Recommended Posts

1: Basic outline.

I have been trying to write a script which sends a message when somebody clicks on the object, started with a sample script in a prim. It worked.

default
{ 
    touch_start(integer num_detected)
    {
        key    avatarKey  = llDetectedKey(0);
        string avatarName = llDetectedName(0);
 
        llRegionSayTo(avatarKey, 0, "Hello " + avatarName );
    }
}

Nothing remarkable there. Click on the prim, you get the message. Attach it, still does the same. There's the hand pointer used on mouse over, all as expected.

This sort of scripting is pretty common for attachments such as avatar tails, or hats. It's often called a "clicky". There's a few tools on the marketplace.

Trouble is, the tail I use is a rigged mesh, running an animation. The control, using different animations, is by a chat command. So far, so good. Rez the tail on the ground, add that script, and it all works, just like a prim.

And then...

Wear the tail, and the script doesn't work.

You can get at the "touch" entry in the right-click menu, and that generates the message, but the position in the menu seems to change with whether you or somebody else is wearing the object. Maybe it can be said to work but this is, we may say, sub-optimal.

2: Documentation

OK, I looked. Started with http://wiki.secondlife.com/wiki/Touch and the related pages. Nothing there. Tried to find whether attaching the rigged mesh was relevant., because the script worked when it wasn't attached.

I started using other words than "sub-optimal". That web page is three years old, but rigged mesh was around when it was last edited. I speculated whether some Lindens are good for anything more than paying for coffee at the coffee shop across the road.

3: My system

Yes, I usually use Firestorm. I use Linux and the only version available from Linden Lab is from November 2017. I did try the Linux version of Cool VL Viewer with no apparent difference. That's hardly a surprise, but anyone who asks me if I have tested this on the "Official" viewer, I wouldn't trust to drink hot coffee without a dreadful accident. As for the JIRA, I think the last time I mentioned Linux there, they called for an exorcist.

4: Conclusions

The documentation may be incomplete, or it might be badly organised. It easily could be both. But if anybody does know of how a touch event on an attached rigged mesh works, can they let us all know? I can see a couple of possibilities, such as the script having to be in the root of the whole Avatar, but that would add complications. I gather that putting up a menu is possible, but I don't use any rigged attachments that do

5: Note on Animesh

I have made this tail work as Animesh, but as an attachment there are several niggling problems. It can behave oddly after a sim crossing, for instance, apparently because of displacement of the distinct skeleton.. I haven't tested the touch event on any animesh, attached or otherwise.

Link to comment
Share on other sites

You can't click rigged meshs. my understanding is that they aren't into whatever raytrace system the viewer uses to figure out what object has been clicked.

You can however click unrigged objects that have been linked to that rigged mesh.

  • Like 1
Link to comment
Share on other sites

3 hours ago, Kyrah Abattoir said:

You can't click rigged meshs. my understanding is that they aren't into whatever raytrace system the viewer uses to figure out what object has been clicked.

You can however click unrigged objects that have been linked to that rigged mesh.

What you're saying does make sense.

So where is it documented?

Link to comment
Share on other sites

If it does work, there is definitely something more to it. I can link a prim to the mesh tail while it's not attached, but as soon as I wear the item, the non-rigged prim vanishes and doesn't return. It doesn't matter which of the two parts is the root. And it puzzles me that this use fails, but I can wear items that can be clicked on, and respond with a menu, which calls into question your basic idea. You can click on rigged mesh. If it comes to that, how is the viewer able to detect the initial right-click?

I am not having coffee at this time of day, I need to get some sleep this weekend. But it looks like the available script tools pre-date rigged mesh, which makes it feel as though something big changed.

 

 

Link to comment
Share on other sites

I can't really explain it, my assumptions come merely from observation since rigged meshs where released, the right clicking aspect seem to vary with some modded clients but you'll also notice that the selection outlike for rigged meshs also sometimes doesn't appear where the rigged mesh should be.

The non rigged root/childprim should be where the attachment was actually attached, since this is the "true" location of your attachment.

Can't really link to a documentation it's just how it has been so far, There has already been bug reports opened on the fact rigged meshs can't be clicked when they are worn but they did not lead anywhere.

Link to comment
Share on other sites

On 5/3/2019 at 9:32 PM, arabellajones said:

If it does work, there is definitely something more to it. I can link a prim to the mesh tail while it's not attached, but as soon as I wear the item, the non-rigged prim vanishes and doesn't return. It doesn't matter which of the two parts is the root. And it puzzles me that this use fails, but I can wear items that can be clicked on, and respond with a menu, which calls into question your basic idea.

  1. Make a default cube, don't make it invisible or anything.
  2. Make the prim the root. (Doesn't really matter, but let's make this simple.)
  3. From your inventory, add it to an attachment point that makes sense. (Default point is always right hand.)
  4. Once you have it attached, right-click the attachment from your inventory and select "Edit."
  5. From the edit window, make sure that the position is set to 0, 0, 0.

If after this you still cannot see the prim AKA root, there's something wrong with your mesh that offsets the attachment point so much that you can't even find it. But at this point you should see the prim where you'd expect it, and be able to left-click on it after you put a script in it.

Link to comment
Share on other sites

I am working with a similar situation, but with animesh. This is what I have experienced so far, please chime in if I am wrong.

With animesh all of the objects attached have to be rigged mesh or they will not animate. Attaching even a regular mesh prim to the rigged mesh, as root or not... the mesh object does not move (animate) with the animesh character (because it doesn't attach to the bones). I believe that may just be a limitation on animesh though and should not affect your attachment to an actual avatar. (Disclaimer: I am not a raw mesh creator so I only know a bit about the inner workings of mesh)

As a work around, I have considered making a simple rigged mesh object that will be slightly larger than the animesh character itself. But if, indeed, rigged mesh can not register the touch event normally, that will not solve my issue. But it might work for you if none of the other suggestions work.

Is just a thought.

Edited by Riannah Avora
clarification
Link to comment
Share on other sites

The basic tech was used, years ago, to generate messages for when people clicked on tails, ears, and such for furry characters. There are still several scripts for this on the Marketplace, but they are all very old, pre-Mesh. It's known as a "clicky".

I know some rigged mesh add-ons can show a menu when they're clicked on.

My own experience creating mesh is that mouse-clicks only get detected when a rigged mesh isn't attached to an avatar, which contrdicts what I see.

So somebody knows how to make a rigged mesh react to a mouse-click. But nobody can point to any documentation, no example code, no guidance on mesh creation, it's just something they heard, but can't explain.

I can make efficient, low-complexity, mesh clothing. I can examine a rigged mesh, and find some sort of mesh component that contains the menu script, but it all ends up unexplained and undocumented.

Can anyone rely on an undocumented feature working after the next server or viewer roll-out? The Lindens do try not to break existing content, but how would they know about this? If people know about this, why can't they point to documentation? The Lindens have a problem with multiple names for the same thing. I might just have not used the right jargon as a search term. But why does nobody else seem to know the word?

I feel as if I am wasting my time. I may check this thread again, but I wonder if it is worth bothering.

 

Link to comment
Share on other sites

I've just had an interesting time dropping a script into my tweed jacket, first  in Singularity, then in the latest LL viewer. Singularity didn't respond to a touch, but with LL's viewer, I was able to get it to say it had been touched. I had a line in the state_entry llSetClickAction(CLICK_ACTION_TOUCH) but didn't check first whether the touch would register without it. BUT, the only way it would detect the touch was to first right-click the suit and then select touch from the menu, just clicking on the jacket didn't work or even offer the touchable cursor. Singularity doesn't offer touch on the right-click menu.

Might be worth you trying this with several viewers to see which gives you touch in the right-click menus?

However, I don't know if the jacket and suit I have are fitted mesh or rigged mesh. I suspect fitted, but I don't know if that makes a difference.

Edited by Profaitchikenz Haiku
Link to comment
Share on other sites

4 hours ago, Profaitchikenz Haiku said:

the only way it would detect the touch was to first right-click the suit and then select touch from the menu,

That trick works in other contexts too.  I was recently adding a texture change script to some furniture that has AvSitter in it.  If you mouse-over, the cursor icon shows a sit action default, so AvSitter takes over when you do a left click.  If you right click and select Touch, though, the texture change script menu pops up.  I was pleasantly surprised.  I don't use Singularity, so it didn't occur to me that there might be a viewer without that option. 

Link to comment
Share on other sites

adding to what @Profaitchikenz Haiku said

link the mesh to a prim. Prim as root. In the prim then script:

default
{
    state_entry()
    {
        llSetClickAction(CLICK_ACTION_TOUCH);
    }

    touch_start(integer total_number)
    {
        llSay(0, "Touched.");
    }
}

then when the mesh is a skirt say, attach it to your hip, size the prim to fit close-ish so it can be touched  as if touching the mesh, set the prim to transparent

with a mesh tail which can wiggle quite a bit then make a prim cylinder as root, set transparent, and wrap it around the tail base close to your butt, so is easier to touch the root prim

 

 

Link to comment
Share on other sites

This is not a bug, but a feature...

LL intentionally coded touch (left mouse button click) in the viewer to ignore rigged meshes. This is not because it could not be done (it could !), but my guess (since no comment in their code explains it) is that the rationale behind it was that rigged meshes are supposed to ”replace” the SL body mesh, and the latter is not clickable either !  Allowing to touch your rigged mesh body would, for example, prevent you from stirring your avatar with the mouse (by touching its body an keeping the left mouse button pressed while you move the mouse to stir).

You may however right click rigged meshes and choose ”Touch” in the pie menu to get the desired effect... On the condition that you did enable ”Pick rigged mesh” in the Tools menu of the viewer.

  • Thanks 3
Link to comment
Share on other sites

16 hours ago, Henri Beauchamp said:

This is not a bug, but a feature...

LL intentionally coded touch (left mouse button click) in the viewer to ignore rigged meshes. This is not because it could not be done (it could !), but my guess (since no comment in their code explains it) is that the rationale behind it was that rigged meshes are supposed to ”replace” the SL body mesh, and the latter is not clickable either !  Allowing to touch your rigged mesh body would, for example, prevent you from stirring your avatar with the mouse (by touching its body an keeping the left mouse button pressed while you move the mouse to stir).

You may however right click rigged meshes and choose ”Touch” in the pie menu to get the desired effect... On the condition that you did enable ”Pick rigged mesh” in the Tools menu of the viewer.

My initial reaction to this is short and vulgar and expresses astonishment at why this isn't documented. How can anyone at Linden Lab be sure of what the code is supposed to do?

 

Link to comment
Share on other sites

23 hours ago, Henri Beauchamp said:

prevent you from stirring your avatar with the mouse (by touching its body an keeping the left mouse button pressed while you move the mouse to stir).

I never knew that was possible, but now I've tried it I see how very handy it is.

I also suspect that with people who wear clickable attachments some confusion could arise when hovering and clicking them if the body intercepts any click attempts not quite on target for the attachments. ( I speak as one who used to do a lot of clicking on avatars wearing clickable attachments :)

Link to comment
Share on other sites

On 5/11/2019 at 10:10 PM, Kyrah Abattoir said:

Option B: Rigged mesh transforms happen on the GPU end and click raycasts on the CPU, so they don't ”see” the same thing.

Option 😄 Raycasting against rigged objects might have been seen as too expensive.

Raycasting against rigged meshes *does* occur and is fully implemented in the viewer. It is just not taken into account for touch events, drag and drop, etc... Again, the rationale was probably that since rigged meshes were destined to replace the SL avatar mesh body parts, they were to be considered as the latter and not as a ”normal” attachment...

Link to comment
Share on other sites

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