AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.3k stars 909 forks source link

Marker content not aligned. #543

Closed allestaire closed 8 months ago

allestaire commented 1 year ago

Do you want to request a feature or report a bug?

What is the current behavior? When scanning a barcode, seems like the marker content is not aligned to its position

If the current behavior is a bug, please provide the steps to reproduce.

Please use this link https://aliancial-ba0q6xfp8-allestaireacasio-ustpeduph.vercel.app/ image

Screen Shot 2023-06-02 at 8 10 28 AM

Please mention other relevant information such as the browser version, Operating System and Device Name

What is the expected behavior?

The Object should be centered to markers point

If this is a feature request, what is motivation or use case for changing the behavior?

Example Code:

<a-scene embedded arjs="trackingMethod: best; sourceType: webcam; debugUIEnabled: false; debug: true; detectionMode: mono_and_matrix; matrixCodeType: 5x5;">
        <a-marker type="barcode" value="300">
            <a-box position='0 0.5 0' color="red"></a-box>
        </a-marker>
        <a-entity camera></a-entity>
      </a-scene>

Versions:

allestaire commented 1 year ago

Got this link for similar issue https://github.com/AR-js-org/AR.js/issues/241

allestaire commented 1 year ago

Also already tried the <a-box> positioning but I don't think this will solve my issue, what I want is to make its viewpoint similar to scene so that the markers content not needed to define its position attribute

allestaire commented 1 year ago

https://github.com/AR-js-org/AR.js/assets/68372409/1d4b6d09-ecf4-4da7-bc3a-68b9c96a5d71

This is an update. trying to figure out to place to center, but noticed that, the object is getting far away when the image is change on rotation

<a-box position='0.5 0.5 -2' color="red"></a-box>

allestaire commented 1 year ago

I found the issue now, seems like the problem is with the height of viewpoint, because the scene was loading after anything else, (NextJS)

https://github.com/AR-js-org/AR.js/assets/68372409/955514f8-e310-4a8d-9ef1-38b24d8b3051

allestaire commented 1 year ago

An update to this issue, An alternative solution is to use iframe, as what others did but it is not a good solution, My idea on why it should be on NextJS or React, is to have a marker being dynamically loaded Which is on this case, cant control the content

https://github.com/AR-js-org/AR.js/assets/68372409/2897a238-b755-4d4f-ada3-db2f79c7d9e0

madalin-fr commented 1 year ago

Check out https://github.com/AR-js-org/AR.js/blob/master/aframe/examples/marker-based/minimal_ES6.html and the css used there

allestaire commented 1 year ago

Check out https://github.com/AR-js-org/AR.js/blob/master/aframe/examples/marker-based/minimal_ES6.html and the css used there

Thanks on this!!

loganknecht commented 8 months ago

Hello @allestaire - Were you able to resolve this?

I have been encountering the same issue and I cannot figure out what to do to resolve this. See: #576

@madalin-fr - I have tried your Minimal ES6 example and I am still experiencing the offset issues. Do you have any other suggestions?

allestaire commented 8 months ago

Hi @loganknecht ,

Base on my diagnosis, there is a problem with the element wrapper on the canvas, it is using different width, but still dont know its source, I tried using the raw ARJS rather than the react package.

As of now this error only occurs on react, but not on RAW html version

loganknecht commented 8 months ago

@allestaire can you clarify which element you mentioned.

More than happy to track this down, but not sure what portion you're discussing.