- This topic has 18 replies, 6 voices, and was last updated 4 years, 2 months ago by GLiFTeK.
-
AuthorPosts
-
2019-04-25 at 10:44 pm #14237scalareCustomer
I’m sorry, but here is another question
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!
2019-04-26 at 7:15 am #14245Yuri KovelenovStaff2019-04-27 at 9:43 pm #14268scalareCustomerHey 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!2019-05-02 at 2:51 pm #14396scalareCustomerHi Yuri,
any comments about this? Thanks a lot!
2019-05-02 at 3:10 pm #14399Yuri KovelenovStaff2019-05-02 at 11:29 pm #14404scalareCustomerHi 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
2019-05-06 at 11:42 pm #14474scalareCustomerHello Guys,
any comments/ideas about this issue? Am I missing something?
Thank you in advance!
Andrés2019-05-07 at 12:30 pm #14494garyCustomerUsing a when moved can help test if mouse is being “dragged” in this case…
Note: A wee bit more testing reveals that after: 0.1 seconds seems to work better.
2019-05-08 at 7:11 am #14522Yuri KovelenovStaff2019-05-08 at 12:29 pm #14549scalareCustomerHi 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!
2019-05-09 at 2:19 am #14560scalareCustomerSo, 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!
2019-05-09 at 2:15 pm #14574scalareCustomerOK, 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!
2020-02-21 at 3:35 pm #23822muggaParticipant@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”.
2020-05-19 at 11:54 am #27750GLiFTeKCustomerAlso, 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!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.
Visit the GLIFTEK Verge3D Plugins Store!
GLIFTEK.com for Plugin Documentation & LIVE DEMOS!
LIKE The GLIFTEK Facebook Page for updates!
Join the Verge 3D Discord Server!
plz share Discord link & on your signature!2020-05-19 at 2:18 pm #27766scalareCustomerHi 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
-
AuthorPosts
- You must be logged in to reply to this topic.