How to bind a MouseEventControl to an invisible Spatial?

Being able to fire MouseEventControl from Spatial is cool; but I’d also like to bind invisible Spatials. And I really mean “invisible”: not painted on screen, not interfering with shaders and so on.
How should I do that?

A Node is a spatial thats not rendered, setting a cullhint for geometry also causes them not to be rendered (but still updated).

1 Like

I mean… if you have a mouse event control then that implies that you want it to receive mouse events… which means it has to have a mesh of some kind. Or am I misunderstanding?

But if you want to make it invisible then, yeah, just set the cull hint. Collision detection (and this Lemur’s picking) ignores cull hint.

1 Like

Worked like a charm :smile:

Now I’d like to “manage” a lemur TextField. Usually, I can enter text by clicking on it, but I want to have text focus with the aforementioned collision detection.

Unfortunately, TextField does not have the awt luxury like “requestFocus()” or the like, and the underlying TextEntryComponent isn’t even a Spatial to begin with… what should I do?

Well, the only reason that TextField gets the focus when it’s clicked on is because:
addControl(new MouseEventControl(FocusMouseListener.INSTANCE));

Maybe that helps… I mean, you can look in the code of FocusMouseListener to see what it’s doing.

Edit: actually I’ll save you the time: GuiGlobals.getInstance().requestFocus(target);

1 Like