react-three-arjs
react-three-arjs copied to clipboard
onClick Not working on Mesh
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
Alright, i see. The video element receives the clicks instead of the canvas objects. I'll fix that.
Fixed in v0.5.2
(see b971d7f)
@Carlos-AvilesBuitron Thanks for the hint!
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: @.***>
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?
I see there's still a problem on mobile devices. Works well on desktop in my case. Reopening..
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
I see, thanks for keeping up with this. Looking forward to the merge.
I am running into this problem as well, mesh click handlers are not fired. Any updates on this?
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