GuiNode – nifty and RootNode overlapping

Hello all,

When the user put the mouse over a brown square, the square is red enlightened. Everything work like a charm…

Recently a try to add some hud with the help of nifty.

When the user move the mouse over a nifty panel and if a brown square is “under” this panel. The square is enlightened…

How can I “say” :


if (the mouse is over a nifty Panel) {

DISABLE PickingManager AppState


else {

ENABLE PickingManager AppState



I don’t know if this is possible because my hud screen is composed of two panel :

Here is my nifty declaration made in a AppState - ScreenController :


NiftyJmeDisplay niftyDisplay = new NiftyJmeDisplay(assetManager, inputManager, app.getAudioRenderer(), app.getGuiViewPort());

nifty = niftyDisplay.getNifty();

nifty.fromXml(“Interface/Nifty/gui.xml”, “hud”, this);



I try with “GuiViewPort()” and “ViewPort()” with the same result.

Here is my PickingManager update loop that I want to disable :


// results list.

CollisionResults results = new CollisionResults();

// the ray from cam loc to mouse

Vector3f origin = app.getCamera().getWorldCoordinates(inputManager.getCursorPosition(), 0.0f);

Vector3f direction = app.getCamera().getWorldCoordinates(inputManager.getCursorPosition(), 0.3f);


Ray ray = new Ray(origin, direction);

if (results.size() > 0) {

CollisionResult closest = results.getClosestCollision();




I realize I am not very clear, sorry.




[java]if (the mouse is over a nifty Panel) {

DISABLE PickingManager AppState}

else {

ENABLE PickingManager AppState} [/java]

there are nifty event subscribers for mouse move events, so you should be able to check the id for 1 of your panels, there maybe on focus (I can’t remember)

1 Like

Thank you for the clue !!

I modify my nifty-gui.xml with interact onMouseOver


<panel id="panel_bottom" width="100%" height="20%" childLayout="horizontal" >

<interact onMouseOver="disablePicking()"/>

<control name="button" label="Quit" id="QuitButton" align="right" valign="center"/>

<control name="button" label="Start" id="QuitButton" align="right" valign="center"/>



And for the top panel :

[xml]<interact onMouseOver="enablePicking()"/>[/xml]

1 Like

it seems visibleToMouse=“true” attribute on the panel should normally consume the mouseEvent. You can still choose to transmit it if needed but nifty doesn’t transmit the event to the main application and treat the event if you attach something on it by default for all the elements with that attribute.

1 Like


My solution with panel interaction :

[xml]<interact onMouseOver=“disablePicking() / enablePicking()”/>[/xml]

works well but all mouse clicks are disabled…

The solution with [xml]<panel id=“panel_bottom” … visibleToMouse=“true”> [/xml]

consume the mouse clicks but don’t consume the mouse moves.

In the “disablePicking() / enablePicking()” methods, here is the simple code :

[java]stateManager.getState(PickingManager.class).setEnabled(true / false);[/java]

How can merged the two solutions ?