Get Object on mouse click

hi there,

I have a problem to get the real mouseover object on mouseclick.

I am using this:

    private void update(float time) {
        if (leftWasDown) {
            leftWasDown = false;
            Vector2f screenPos = new Vector2f(MouseInput.get().getXAbsolute(),
            Vector3f worldCoords = DISPLAY.getWorldCoordinates(screenPos, 0);
            Vector3f worldCoords2 = DISPLAY.getWorldCoordinates(screenPos, 1);
            Ray mouseRay = new Ray(worldCoords, worldCoords2);
            rootNode.findPick(mouseRay, pr);
            // System.out.println(pr.getNumber());
            if (pr.getNumber() != 0) {
                if (selectedObject != null) {
                    selectedObject.setLocalTranslation(new Vector3f(0.0f, 0.0f,
                selectedObject = pr.getPickData(0).getTargetMesh();
                selectedObject.setLocalTranslation(new Vector3f(0.0f, 1.0f,
        if (value(LEFT) != 0) {
            leftWasDown = true;

At the end pr should contain all objects in line of mouse.
My problem is now:
I have a field of hexagons. when I click in the middle of the screen, i get the object mouse is over, but when I move the mouse in an random direction and click then, I get not the object under the mouse, i get objects which are nearer to the middle of screen than the ones I would like to click on. Did i missed something in the use of getWorldCoordinates?


mh, sry. I found my mistake. I have an absoluteMouse, which I translate on mouse move, but I dont update the hardware mouse. Thats why I get the wrong object selected.