aframe icon indicating copy to clipboard operation
aframe copied to clipboard

raycasting with mouse not on the object position when "embedded"

Open RQnet opened this issue 3 years ago • 6 comments

i want to implement touch icons close to the marker. I uses property embedded and arjs sourcetyp= webcam on desktop PC it is working but on Android phone the raycast is not on the correct position when the camera angle is changed to the marker. without "embedded" it seems the raycast is working correct. but in this case the solution is not right in different devices

so my question is. How can i fix the racst problem?

  • A-Frame Version: 0.9.2 (with higher Versions the raycast makes much more trouble with wrong position)
  • Platform / Device: Samsung Galaxy S8 (Android 9)
  • Reproducible Code Snippet or URL:
<a-scene cursor="rayOrigin: mouse; fuse: false"
embedded arjs='sourceType: webcam; patternRatio: 1; trackingMethod: best; maxDetectionRate: 60; detectionMode: mono; debugUIEnabled: false;' renderer='antialias: true; alpha: true; precision: medium;' > 

  <a-marker preset="kanji" 
    id="marker-kanji" 
    smooth="true"
    smoothCount="5"
    smoothTolerance="0.02"
    smoothThreshold="2"
    emitevents="true" 
    registerevents
    raycaster="objects: .raycastable">

    <a-entity id="ui" position="0 0 0">
      <a-entity id="menu" highlight>
        <a-box id="box" position="0 0 0.1" scale="1 1 1.2"
        material="opacity: 0.5; side: double;color:blue;" shadow class="raycastable" boxevents
        animation="property: rotation; from: 0 0 0; to: 0 180 0; dur: 2500; easing: linear; startEvents: turn;">
        </a-box> 
      </a-entity>
    </a-entity>
  </a-marker >

  <a-entity id="camera" 
    position="0 0.01 0"
    camera>
  </a-entity>
</a-scene>

<script>
  //open Tab with linked Url
AFRAME.registerComponent('boxevents', {

init: function ()  {
  var box = document.querySelector('#box');
  box.addEventListener('click', () => {
    box.emit('turn');
  });
}
});
</script>

RQnet avatar Nov 25 '21 15:11 RQnet

Make sure you are using A-Frame 1.2.0

dmarcos avatar Nov 27 '21 03:11 dmarcos

Can you reproduce the issue with A-Frame without ar-js? Might wanna check https://github.com/AR-js-org/AR.js/issues/40

dmarcos avatar Nov 27 '21 03:11 dmarcos

@dmarcos thanks for answer me. With A-Frame highter than 0.9.2 it gets more worst. With A-Frame 1.0.2 and 1.0.4 exactly the same position. and right it seems same like the issue the other people have. for example [https://github.com/jeromeetienne/AR.js/issues/584]

i will check if i can reproduce without ar.js. You mean with tree.js right?

i wondering that with AFrame 0.9.2 it works on PC an makes problems on Phone. Could you reproduce the issue?

RQnet avatar Nov 29 '21 13:11 RQnet

You should be using A-Frame 1.2.0.

I meant trying to reproduce raycasting + A-Frame + embedded without ar.js. AR js is a 3rd party library not maintained by us and the bug looks like an integration problem on their side.

There's a solution / workaround on the issue I referenced you can try.

Sorry. I'm not familiarized with the intricacies of ar.js

dmarcos avatar Dec 01 '21 00:12 dmarcos

the raycasting A-Frame + embedded without ar.js is working fine. without ar.js i can not use webcam but i need. I checked your workarround. this just works with AFrame 0.9.2 on without embedded. Not working with 1.0.2.

So the problem ist still there. hmm i really wondering that not more developer have this problem.

RQnet avatar Dec 01 '21 17:12 RQnet

I think this has to be fixed on the ar.js side

dmarcos avatar Jan 12 '22 14:01 dmarcos

I'm closing this because not sure there's anything to be done on A-Frame side. Can reopen if necessary.

dmarcos avatar Nov 19 '22 03:11 dmarcos