Get Geometry bellow another

So i am finding the piece the user is looking at with a ray but then i want to get the square name bellow it. I thought about getting the square name by using some kind of collision detection between the piece and square, however I don’t know how to do this. Currently the currentBoardPos will only be set right if i am looking directly bellow, how can i modify this code to work.

private ActionListener actionListener = new ActionListener() {
public void onAction(String name, boolean isPressed, float tpf) {
if(name.equals(“Click”) && !isPressed) {
target = null;

CollisionResults results = new CollisionResults();
Ray ray = new Ray(cam.getLocation(), cam.getDirection());

w.collideWith(ray, results);
b.collideWith(ray, results);

board.collideWith(ray, results);

if (results.size() != 0 && (results.getCollision(0).getGeometry().getName().contains(“white”) || results.getCollision(0).getGeometry().getName().contains(“black”)))
//sets selected piece
target = results.getCollision(0).getGeometry().getName();
//gets the board spot the piece is on by getting the 2nd thing the ray hits
currentBoardPos = results.getCollision(1).getGeometry().getName();
//depending on color, gets the piece from the node array and gets its place in the array
if (target.contains(“black”))
targetPos = b.getChildIndex(results.getCollision(0).getGeometry());
blackSelectedPiece = target;
currentBlackPos = currentBoardPos;
else if (target.contains(“white”))
targetPos = w.getChildIndex(results.getCollision(0).getGeometry());
whiteSelectedPiece = target;
currentWhitePos = currentBoardPos;

//sets selected piece to red

//if not a piece, dont set anything
currentBoardPos = “”;
}; [/java]

Never-mind, I found a solution, you just needed to use the contact point of the first collision.