Problem with mouse click (Raycaster) - can't recognize right click

Hello everyone. What’s up?
I’m new with ThreeJs and I’m here working with Raycaster. I can’t seem to get it to recognize click types other than left-click. Is there some limitation of it?

Another curious fact is that I can’t even through javascript functions
functions that I found on StackOverflow to capture these other clicks.

Here there live demo: https://jsfiddle.net/mqdevWG/Lxp31ad4/4/

Thanks in advance, any kind of help will be very welcome.

Hi, MQdev

Maybe this can help you!!

2 Likes

Thank you for your quick reply @M3lk0r. The platform I am using does not allow imports of modules, I use handlebars in development, and this integration, for some reason is not allowed… I am even using /js from the ThreeJS library and not /jsm

Do you know if this might work in my case?

Hey
First thing first, always remember that targeting your event listeners is really important.
Try to use domElement of your renderer first.

Besides that, keep in mind that WebGL handles pointer event better than mouse, for example, pointer does exist on mobile devices but mouse event does not. Try using
window.addEventListener('pointerup', onClick, false);

2 Likes

Perfect. That solved my problem. Thank you @gorskidev !