[SOLVED] raycastFirst is not working

Hi, in this project https://playcanvas.com/editor/scene/426859 I have this script https://playcanvas.com/editor/code/394407/ClickHandler.js on my camera entity object, but my mouse events are not working with raycastFirst.

PS: I have a similar project with almost the same script that raycastFirst works just fine.

Any ideas?

Seems to work for me. When I click any of the cubes, the red cube goes bright for a moment. Subsequest clicks do nothing though. So I suppose it’s something wrong with your material swapping logic.

To be sure your raycast works fine add console.log(‘raycast’) inside callback and then watch the console while clicking cubes.

1 Like

Underlight, I put a breakpoint in the callback function, but it was not stopping on breakpoint… I think its related to the callback scope, IDK… I put a console.log and its logging, ty for your help, it seems to be working…

Thank you again.