0
votes

i build a simple app with a-frame and i see that if i run the app in an android device after any mouseup event my cursor moves in the position where i clicked. this is a bit annoying because i use the mouseup event from my vrbox controller who have the pointer in a different position than my app cursor. i want to use the mouseup event only to run the events related to the objects pointed by my cursor (then not pointed by controller arrow).

probably the solution is to block the cursor position after any mouseup event. there is a way to do this? thanks in advance my code is this

home.html

<a-scene>
  <a-entity id='cameraWrapper' position="0 -3 0" rotation="0 45 0">
    <a-camera>
      <a-entity cursor="fuse: true; fuseTimeout: 100;"
            position="0 0 -1"
            geometry="primitive: ring; radiusInner: 0.005; radiusOuter: 0.01"
            material="color: black; shader: flat">
       </a-entity>
    </a-camera>
  </a-entity>

  <a-sky id="image-360" radius="20" src="./img/startroomHD.jpg"></a-sky>

  <a-box event-listener position="-8 0 -8" rotation="0 45 0" depth="1" height="10" width="20"></a-box>
</a-scene>

controller.js

angular.module('app.controller', ['app.service', 'firebase', 'ngCordova'])

.controller('HomeCtrl', function($scope){
      AFRAME.registerComponent('event-listener', {
      init: function () {
         this.el.addEventListener('mouseup', function(evt){
             console.log("ciao");
         });
       }
    });
});
1

1 Answers

0
votes

https://aframe.io/docs/0.6.0/components/raycaster.html#whitelisting-entities-to-test-for-intersection

We usually don’t want to test everything in the scene for intersections (e.g., for collisions or for clicks). Selective intersections are good for performance to limit the number of entities to test for intersection since intersection testing is an operation that will run over 60 times per second.

To select or pick the entities we want to test for intersection, we can use the objects property. If this property is not defined, then the raycaster will test every object in the scene for intersection. objects takes a query selector value: