react-three-arjs icon indicating copy to clipboard operation
react-three-arjs copied to clipboard

onClick Not working on Mesh

Open Carlos-AvilesBuitron opened this issue 2 years ago • 9 comments

I am trying to fire an onClick function on a cube mesh that is a child of a Marker. I get no errors but the function never fires on click.

Is this an issue or am I missing something?

Thanks

Carlos-AvilesBuitron avatar Jul 26 '22 19:07 Carlos-AvilesBuitron

Alright, i see. The video element receives the clicks instead of the canvas objects. I'll fix that.

j-era avatar Jul 28 '22 10:07 j-era

Fixed in v0.5.2 (see b971d7f) @Carlos-AvilesBuitron Thanks for the hint!

j-era avatar Jul 28 '22 10:07 j-era

Thank you for the fast update. I'm not seeing it work though. I see what you meant by adding the "pointer events none". But I still do not see the event click happen on my mesh. Can you add an onClick to the box mesh in your sample and have it just window.alert? I'm trying to do exactly that but no alert shows.

Thanks again for your great work.

On Thu, Jul 28, 2022 at 6:51 AM jens @.***> wrote:

Closed #22 https://github.com/artcom/react-three-arjs/issues/22 as completed.

— Reply to this email directly, view it on GitHub https://github.com/artcom/react-three-arjs/issues/22#event-7080323862, or unsubscribe https://github.com/notifications/unsubscribe-auth/AY5SFN3YCVKF75AH6YLPMKLVWJQ4XANCNFSM54XD52RA . You are receiving this because you were mentioned.Message ID: @.***>

Carlos-AvilesBuitron avatar Jul 28 '22 12:07 Carlos-AvilesBuitron

Okay, think it's generally working https://codesandbox.io/s/determined-smoke-eo3jbn?file=/src/index.js ..but I recognize that some clicks are not handled, maybe some frames missing the tracking. Could you try the example, maybe it's working good enough for your usecase?

j-era avatar Jul 28 '22 15:07 j-era

I see there's still a problem on mobile devices. Works well on desktop in my case. Reopening..

j-era avatar Jul 28 '22 15:07 j-era

There's a problem concerning portrait view. Ar.js generates a css margin-left which is taken into account in the r3f event system. I think the solution should be this PR

j-era avatar Aug 02 '22 12:08 j-era

I see, thanks for keeping up with this. Looking forward to the merge.

Carlos-AvilesBuitron avatar Aug 02 '22 16:08 Carlos-AvilesBuitron

I am running into this problem as well, mesh click handlers are not fired. Any updates on this?

LucusWebsites avatar Nov 24 '22 10:11 LucusWebsites

Should be fixed in 0.5.6 Missed updating projectionMatrixInverse https://github.com/artcom/react-three-arjs/blob/d821c16c975e17a18612a227e05caaf87b938239/src/ar/ar.jsx#L96 Updated example -> https://codesandbox.io/s/jolly-hodgkin-ssu33

j-era avatar Jul 18 '23 11:07 j-era