dbawel Posted October 25, 2016 Share Posted October 25, 2016 Hello, How do I use 2 canvas pointerdown events to trigger 2 seperate actions, as I just received the requirement at the last minute that two users had to use the touchscreen for the same event triggered by their seperate touch events. However, it appears that hand.js sends a pointerup event as soon as a second pointerdown event is triggered. Any thoughts? I\m quite worried now. Also, I can't set regions for each pointer event - it must work on the entire touchscreen. Thanks, DB Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 25, 2016 Share Posted October 25, 2016 Hello David,I'm not sure to understand the issue. You can still capture pointerdown event and check the pointerId to separate the two users? If hand.js is the problem, you can try jquery PEP.js dbawel 1 Quote Link to comment Share on other sites More sharing options...
dbawel Posted October 25, 2016 Author Share Posted October 25, 2016 Hi @Deltakosh, I'm not certain how to set the IDs for each pointer event, and use tis in a function to have the same or seperate funtion controlled by a specific pointer ID. It's simply my lack of knowledge in identifying and using pointerID. Thanks, David Quote Link to comment Share on other sites More sharing options...
Nabroski Posted October 26, 2016 Share Posted October 26, 2016 Hello i read the question yesterday. Also from my side, i don't really understand what you are going for. So their will be two players before a thouch screen, one have a red ball and the other will have a blue ball. You can assign a event to those meshes. Make a callback. Quote Link to comment Share on other sites More sharing options...
dbawel Posted October 26, 2016 Author Share Posted October 26, 2016 @Nabroski, @Deltakosh, and all, Thank you for loking at this. I guess I didn't describe well enough what the project requirements are. I have created a simulation of cells floating and colliding in a volume, and am creating a new collision object which must scale at intervals to reveal a message and also move around the screen to colide with the "cells" who obviously have imposters. So I'm using canvas event listeners for pointerdown and pointermove, and for pointerup the "void" collision object used to clear the small area for the message and moving around the screen is then disposed. But 2 persons at a minimum are required to use simultaniously. This is for a trade show in one week to be run on Chromium and a large screen where at east 2 people are permitted to use simultaniously. I have almost everything built, except for multi-user interaction. As always, thank you for you help with this. Cheers, DB Quote Link to comment Share on other sites More sharing options...
Nabroski Posted October 26, 2016 Share Posted October 26, 2016 @dbawel I'm sorry i think someone will catch up soon. Just be aware of canvas.addEventListener execute before everything else, before babylonjs compileAndRun his code. Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 26, 2016 Share Posted October 26, 2016 Do you have a way to share a simple repro of your issue on a page? (As I understand this is not related to bjs right?) Quote Link to comment Share on other sites More sharing options...
dbawel Posted October 27, 2016 Author Share Posted October 27, 2016 @Deltakosh and @Nabroski - The issue is not related to BJS, but to several factors. One that I just learned that a pointerdown event is not held in the event listener for more than a few seconds unless a pointermove event is initiated. So my onpointerup function is not working correctly. Also, a second simultanious pointerdown event removes the first pointerdown event. The link to the scene is below: qedsoft.com/DEMOS2014/PE_KYP/index23.html I must find a way to capture all pointer events and apply then to my functions for at least 2 simultanious users. I've found examples of this using jQuery, but have been completely unsucessful in applying anything that works. I'm very interested in learning about pointerID, but can't locate any info that makes sense to apply. Thanks, DB Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 27, 2016 Share Posted October 27, 2016 The best starting point is this one: https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events In a nutshell, evey pointer events will come with a e.pointerId identifying the "finger". So if two people touch the screen: you will receive two pointerdown where e.pointerId will be different. This pointerId will remain unchanged for each finger until the finger stops touching the screen dbawel 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.