0
votes

have such issue:

using this approach: on touchclick event, from xr mode. currSphere.sceneEl.renderer.xr.getSession().addEventListener('selectstart', ev => { console.log('sphere is clicked; event target:', ev.target);
});
via selectstart event
if user make clicktouch on screen, from vr(xr) mode binded to a-entity selectstart eventhandler is called, but when clicked any possible place on whole scene.

(any on this can be appearing some time; this looks weird to me) Please look at demo on glitch:

http://chrome-80.glitch.me code is available here: https://glitch.com/edit/#!/join/4eb40938-196b-4cb2-8670-fd3cce3d0eb3 Browser chrome 79+; google vr services installed.

Expected behavior: only when click a-entity , not any place on whole scene we should got eventlistener handler calling. 2. for 2 different entities , as on demo expecting different event hanler called on differnet entity. e.q: touchclick on box: console.log('box is clicked'); touchclick on sphere: console.log('sphere is clicked');

current behavior :
when clicked any place on a-scene, by selectstart event, hapenning only a-sphere eventlistener. also possible: sometimes neither one of them is clicked.

Any ideas? i also available in aframe slack channel.

1

1 Answers

1
votes

That's expected behavior. Screen touches via select event don't provide tap coordinates so it cannot be associated with an entity in the scene. The standard API is still under discussion and it will evolve to include more information. I recommend using a fuse and gazed base cursor in the meantime.