Problem with cam rotation, with screen hud

Hello, I 've developed the logic of my game and now I’m trying to do the GUI, I follow this guide https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:nifty_gui_xml_layout

and I’ve used the equal example , this is the relative code :

[java]
<?xml version=“1.0” encoding=“UTF-8”?>
<nifty xmlns=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance
xsi:schemaLocation=“http://nifty-gui.sourceforge.net/nifty-1.3.xsd”>
<useStyles filename=“nifty-default-styles.xml” />
<useControls filename=“nifty-default-controls.xml” />

<screen id=“start” controller=“Start.MyStartScreen” >
<layer id=“background” backgroundColor="#00FFFF" childLayout=“center”>
<image filename=“assets/mgr.jpg”> </image>
</layer>

&lt;layer id="foreground" backgroundColor="#0000" childLayout="vertical"&gt;
  &lt;panel id="panel_top" height="25%" width="75%" align="center" childLayout="center"
         backgroundColor="#f008"&gt;  
  &lt;/panel&gt;
  
  &lt;panel id="panel_mid" height="50%" width="75%" align="center" childLayout="center"
         backgroundColor="#0f08"&gt;  
  &lt;/panel&gt;
  
  &lt;panel id="panel_bottom" height="25%" width="75%" align="center" childLayout="horizontal"  backgroundColor="#00f8"&gt;  
  
    &lt;panel id="panel_bottom_left" height="50%" width="50%" valign="center" childLayout="center"&gt;  
      &lt;control name="button" label="Start" id="StartButton" align="center" valign="center" visibleToMouse="true" &gt; 
        &lt;interact onClick="startGame(hud)"/&gt;
      &lt;/control&gt;
    &lt;/panel&gt;

    &lt;panel id="panel_bottom_right" height="50%" width="50%" valign="center" childLayout="center"&gt;  
      &lt;control name="button" label="Quit" id="QuitButton" align="center" valign="center" visibleToMouse="true" &gt; 
        &lt;interact onClick="quitGame()"/&gt;
      &lt;/control&gt;
    &lt;/panel&gt;

  &lt;/panel&gt;
&lt;/layer&gt;

</screen>

<screen id=“hud” controller= “NiftyTest.MyStartScreen”>
<layer id=“background” >

   &lt;/layer&gt;

   &lt;layer id="foreground" backgroundColor="#0000" childLayout="horizontal"&gt;
     &lt;panel id="panel_left" width="80%" height="100%" childLayout="vertical" 
  backgroundColor="#0f08"&gt;  
    &lt;!-- spacer --&gt;
  &lt;/panel&gt;
  &lt;panel id="panel_right" width="20%" height="100%" childLayout="vertical" 
  backgroundColor="#00f8" &gt;  
    &lt;panel id="panel_top_right1" width="100%" height="15%" childLayout="center"
         backgroundColor="#00f8"&gt;  
    &lt;/panel&gt;
    &lt;panel id="panel_top_right2" width="100%" height="15%" childLayout="center"
         backgroundColor="#44f8"&gt;  
    &lt;/panel&gt;
    &lt;panel id="panel_bot_right" width="100%" height="70%" valign="center"
         backgroundColor="#88f8"&gt;  
    &lt;/panel&gt;
  &lt;/panel&gt;
  
    
   &lt;/layer&gt;

</screen>
</nifty>

[/java]

When I push run, I’ve the screen id=“screen” when I click for start my game, it change the screen in (id=“hud”) for lifepoint ,score ecc. but I’ve problem with logic:

becouse my game is an fps game, and with the mouse I control the cam rotation of player,so, when the game is running and the GUI is in the hud screen it’s impossible to use the mouse for cam rotation, and I 've on the screen the mouse arrow (it’is not good) . I can just move with(ASDW) and hit with sx mouse button.
How can I remedy?
Thanks in advance :slight_smile:

I’ve dealt with this in the past by changing which mouse button controls the camera.

but I move the camera with the movement of the mouse not with button… :(?

Another approach I’ve used is to enable/disable the HUD using a hotkey.

Can you be more clear, enable/disable the HUD using a hotkey.key. . You have used another approach to disable HUD ? But in xml file? Can I have an example ?

Hotkeys aren’t in the XML. They’re just keyboard keys which generate events when pressed or released.

You might start by reviewing the “Hello Input System” tutorial here

As for an example of an app which uses a hotkey to toggle a HUD, well there’s TestSkyMaterial, but it might be more complex than you want. The source code is
here. The H key is the one used.