How can I get the side of a box with cam-collision

I have this:



[java]

public CollisionResult checkTargetPosition() {

final Camera cam = getCamera();

// Aim the ray from cam loc to cam direction.

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

return checkTargetPosition(getBloxelsNode(), ray);

}

private CollisionResult checkTargetPosition(final Collidable aNode, final Ray ray) {

final CollisionResults results = new CollisionResults();

// Collect intersections between Ray and Shootables in results list.

aNode.collideWith(ray, results);

// The closest collision point is what was truly hit:

System.out.println(“Mouse-Collisions:” + results);

return results.size() > 0 ? results.getClosestCollision() : null;

}

private void markBloxelMouse() {

final CollisionResult cr = checkTargetPosition();

if (cr != null) {

if (bloxelMouseMarker != null) {

rootNode.detachChild(bloxelMouseMarker);

}

bloxelMouseMarker = new Node(“MouseMarker”);

final Geometry targetCopy = cr.getGeometry().clone(false);

final Material matWire = new Material(assetManager, “Common/MatDefs/Misc/WireColor.j3md”);

matWire.setColor(“Color”, ColorRGBA.Green);

targetCopy.setMaterial(matWire);

bloxelMouseMarker.attachChild(targetCopy);

rootNode.attachChild(bloxelMouseMarker);

} else {

if (bloxelMouseMarker != null) {

rootNode.detachChild(bloxelMouseMarker);

}

}

}

[/java]



The result … the crosshair hit’s a box … the box got a additional wireframe … nice.

But how can I highlight only the side where the collision happend?

I give up … there are only Tri’s (two for each side) … how can I highlight them?



Regards

Andreas