It seems like UIButtons (and probably all other UIObjects) doesn’t work well when attached to Nodes that has local translations that != 0. Their hit area seem to be in stuck in the original location.
I made this test scenario:
import com.jme.app.SimpleGame;
import com.jme.input.*;
import com.jme.ui.UIButton;
import com.jme.scene.Node;
public class UIBug extends SimpleGame {
private UIButton button;
private Node uiNode;
private Node cursor;
public void simpleInitGame() {
input = new MyInputHandler();
button = new UIButton(“button”,
input,
“jmetest/data/images/buttonup.png”,
“jmetest/data/images/buttonover.png”,
“jmetest/data/images/buttondown.png”,
100,
100,
1.0f);
uiNode = new Node(“UI Node”);
// Here’s where it goes wrong, try to outcomment…
uiNode.getLocalTranslation().x += 200;
uiNode.attachChild(button);
rootNode.attachChild(uiNode);
rootNode.attachChild(input.getMouse());
rootNode.setRenderQueueMode(com.jme.renderer.Renderer.QUEUE_ORTHO);
}
public void simpleUpdate() {
button.update();
}
public static void main(String[] args) {
UIBug app = new UIBug();
app.setDialogBehaviour(UIBug.ALWAYS_SHOW_PROPS_DIALOG);
app.start();
}
private class MyInputHandler extends InputHandler {
MyInputHandler() {
keyboard = KeyBindingManager.getKeyBindingManager();
keyboard.setKeyInput(InputSystem.getKeyInput());
mouse = new AbsoluteMouse(“Mouse Input”, display.getWidth(),
display.getHeight());
mouse.setMouseInput(InputSystem.getMouseInput());
setMouse(mouse);
}
}
}
And a screenshot that says it all


(the white block beeing the cursor)
/Per
PS: Noticed the same problem when applying RenderStates.