How to catch mouse clicks on a geometry in the guiNode?

I’m trying to identify when the user has clicked on something in the HUD, i.e. a geometry in the guiNode. I’ve added some Geometries to it, using Quads for meshes, and I know where the user has clicked (x,y), but for some reason the guiNode.collideWith(ray, results); doesn’t return any results. I’ve given the Geometries bounding boxes, and I’ve got a ray going from (x, y, -1) in the direction of (0, 0, 1) to ensure it crosses the z-axis.

Am I even going about this the right way, or is there a better way, like manually checking the co-ords of the mouse against the areas of the gui elements?

Thanks in advance.

Then the ray you are using is wrong. We can’t see it, though, so it’s hard to say why.

Something like Lemur also provides picking ‘out of the box’ for any scene graph element, whether in the 3D scene or in the guiNode. (It even supports any custom viewports you might want or whatever.)

A tutorial here on how to use Lemur for scene picking:

It’s in the 3D scene but that works with the guiNode also. (It’s what the normal Lemur GUI elements use internally already.)

Here is the main page for Lemur in case it piques your interest:
http://jmonkeyengine-contributions.github.io/Lemur/

…else post your code so we can spot what’s wrong.

Note: this is backwards but should still be hitting stuff in theory.

Thanks for your pointers. I’ve worked out the problem: I was resizing the quad but not calling updateModelBounds(). I found out after I stepped through the source and saw the wrong worldBounds. </feels stupid>