We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Clicking vs Dragging

Home Forums Puzzles Clicking vs Dragging

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #14237
    scalarescalare
    Licensee

    I’m sorry, but here is another question :scratch:

    I want a click on an object to cause something on the holding HTML page (not important what that is here). I’m controlling that with “when clicked” event puzzle, and it works just fine.

    The problem I have is that if I drag to make the camera orbit around the scene, and when I click to start dragging, I click on the object that has the “when clicked” puzzle, then the click event is triggered, and it causes the same effect on the holding HTML page, but I don’t want that, because I’m supposedly just dragging.

    Is there a way to avoid the click event to trigger when I’m dragging?

    Thank you!

    • This topic was modified 1 year, 2 months ago by scalarescalare.
    #14245
    Yuri KovelenovYuri Kovelenov
    Developer

    you can try using HTML event/mouseup puzzle instead. Leave when clicked puzzle empty to register clicks and fill up the picked object puzzle, which you can check inside that HTML puzzle.

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #14268
    scalarescalare
    Licensee

    Hey Yuri,

    thank you for your suggestion. I’ve tried it, but apparently, the picked object puzzle gets filled up when dragging too. Please see the attached file that shows how I set things up for a test. I get the message printed into the console for both click and drag. If I click on “head-foot-board” to start dragging, nothing gets printed as long as I don’t release the mouse button. I can continue rotating the camera just fine, but when I release the mouse button, the message gets printed to the console.

    Did I interpret your suggestion correctly?
    Thanks a lot!

    Attachments:
    You must be logged in to view attached files.
    #14396
    scalarescalare
    Licensee

    Hi Yuri,

    any comments about this? Thanks a lot!

    #14399
    Yuri KovelenovYuri Kovelenov
    Developer

    Hi,

    can you isolate this issue and attach a narrowed down project here? may be create a temporary project with cubes, etc.

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #14404
    scalarescalare
    Licensee

    Hi Yuri,

    here is a project reduced to the minimal expression, with the puzzles I had copied above. If you try that, and check into the console log, you will see that both when clicking and when dragging (when the mouse button is released), the message is printed into the console.

    I hope this helps to illustrate the problem. Let me know if you need anything else, and thank you very much for your help!

    Andrés

    Attachments:
    You must be logged in to view attached files.
    #14474
    scalarescalare
    Licensee

    Hello Guys,

    any comments/ideas about this issue? Am I missing something?

    Thank you in advance!
    Andrés

    #14494
    Avatargary
    Licensee

    Using a when moved can help test if mouse is being “dragged” in this case…

    when moved puzzle

    Note: A wee bit more testing reveals that after: 0.1 seconds seems to work better.

    • This reply was modified 1 year, 2 months ago by Avatargary. Reason: Tweaked puzzle value
    Attachments:
    You must be logged in to view attached files.
    #14522
    Yuri KovelenovYuri Kovelenov
    Developer

    @scalare this is kinda expected behavior but you can probably change that as was suggested by @gary

    @gary
    Thanks for helping out!

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

    #14549
    scalarescalare
    Licensee

    Hi Yuri, I thought that might be the case after trying what you suggested. I’m not clear on how the “when moved” puzzle might help in this case but I’ll try it out. Thanks Gary!

    #14560
    scalarescalare
    Licensee

    So, this seems to be working as long as I release the mouse button immediately after stopping with the camera drag. If I stop moving the camera, and there is a delay when releasing the button, the click is being triggered, so I’ll have to figure out a way not to identify the delayed release as a separate click.

    In any case, before I noticed that the dragging was causing clicks to trigger, I was monitoring the clicks via collection names, not single meshes. So, in the case of the bed, I would check “when clicked” for the “BEDS” collection, instead of, say, the “head_foot_board” object. I can see that these “when clicked” events will have to be moved inside Gary’s puzzles block, and check which objects were clicked on only when camera_moved is false. But I would like to keep doing it by collection name. Unfortunately, the “picked object” puzzle does this by mesh name, not collection name. So, is there a way to get the “picked collection” name? And if not, is there a way to check if the “picked object” is inside a given collection? (I hope this makes sense)

    Thank you for your help!

    #14574
    scalarescalare
    Licensee

    OK, it looks like I’ve figured it out, the hard way. Instead of using the “when moved” puzzle, which was causing the issue described above about the delay in releasing the button when dragging, what I did was to monitor the pageX and pageY in the “get event property” for both the mousedown and mouseup events, and check how different those values were. If they are different, that means that there was a dragging. If they are the same, then there was just a click. I’ve added some level of tolerance, so that if the difference is within 3 pixels, for example, I assume the user actually wanted to click on the object.

    I could not find how to calculate that delta with other puzzles, so I assume none of this is implemented yet. Also, I had to ask if the delta was bigger than 3 or smaller than -3, because there seems to be no “absolute value” puzzle, which would be a nice addition :-)

    Anyway, this works, but it needs us to create lists with object names for each of the collections we have, which adds a lot of work in the case of having many products for a configurator, each of which will need its own verge3D app. It would be great if we could ask about a “picked collection” instead.

    Thank you for all the help!

    • This reply was modified 1 year, 2 months ago by scalarescalare.
    #23822
    Avatarmugga
    Newbie

    @gary
    Thank you very much for your code example.

    It would be great if for the click event puzzle, there could be an option to implement something like that function. Something like “real click” / “filtered click”.

    #27750
    GlifTekGlifTek
    Licensee

    Also, I had to ask if the delta was bigger than 3 or smaller than -3, because there seems to be no “absolute value” puzzle, which would be a nice addition.

    There actually is one.
    arithmetic operation (with single input)
    Use the “square root” puzzles’ drop-down menu to find it. (Many puzzles have other puzzles in their drop downs)..secret Easter Eggs shhh! B-)

    Anyway, this works, but it needs us to create lists with object names for each of the collections we have, which adds a lot of work in the case of having many products for a configurator, each of which will need its own verge3D app. It would be great if we could ask about a “picked collection” instead.
    Thank you for all the help!

    You can just use the when clicked puzzle then use the collection group selector in it.

    If you want the entire selection picked then use that same group selector puzzle for whatever happens to the group.

    Also if you parent each object in the group to one empty or each their own empty (with the Empty’s in their own collection(s) for more control.

    With constraints in blender you can limit what certain things can or cannot do. If I want my camera to not move when I am doing something, I’ll make constraints with puzzles that turn on and off with Boolean variables.

    #27766
    scalarescalare
    Licensee

    Hi gliftek,

    thank you for your answer. A lot of time has passed since I posted that message, and I was able to solve the issue with the list with object names since then. I don’t think I had found the trick with the hidden puzzle for the abs value though ;-)

Viewing 15 posts - 1 through 15 (of 17 total)
  • You must be logged in to reply to this topic.