Ray casting hit location help?

I been looking into how to get the location of the mesh like a flat surface plain. I am trying to work on RTS game builds. Where units move around in ground or outer space.

Can any one point or show how to code part of it?

You might want to check the TestPick example in jmetest.intersection

You simply have to add your terrain to the node-tree that is used for picking.

However, probs start if things are too near to each other.

here is the code I use for my picking:

        if (MouseInput.get().isButtonDown(0)) {

            Vector2f screenPos = new Vector2f();
            screenPos.set(MouseInput.get().getXAbsolute(), MouseInput.get().getYAbsolute());

            // Create a ray starting from the camera, and going in the direction
            // of the mouse's location
            Ray mouseRay = display.getPickRay(screenPos, false, null);

            // Does the mouse's ray intersect the targetPoint's world bounds?
            PickResults results = new BoundingPickResults();
            pickNodes.findPick(mouseRay, results); //delivers in results
            Spatial targetPoint;// = spinningBox;//todo: we need the difference, not the middle of the box

            String hitItems = "";
            if (results.getNumber() > 0) {

                for (int i = 0; i < results.getNumber(); i++) {
                    targetPoint = results.getPickData(i).getTargetMesh();
                    hitItems += targetPoint.getName() + " " + results.getPickData(i).getDistance();
                    if (i != results.getNumber() - 1) {
                        hitItems += ", ";
                System.out.println("**** gotcha"+results.getNumber()+": " + hitItems);

I'm no pro here, but I'm sad that nobody did answer (not much answer questions here?), so maybe this is of help for you.  :)