Im trying to access a node using the mouse pick tutorial.
in another thread some1 said use getParent() on the geometry and I found another that used this in his method
PickData closest = pickResults.getPickData( 0 );
Tile tile = (Tile) closest.getTargetMesh().getParent();
But I cant see any getParent() function on the javadoc for geometry or geombatch and i get the error
undefined method getParent() for Geom batch
using this code...
if ((MouseInput.get().isButtonDown(0))&&(waitingForClicks == true)) {
Vector2f screenPos = new Vector2f();
// Get the position that the mouse is pointing to
screenPos.set(am.getHotSpotPosition().x, am.getHotSpotPosition().y);
// Get the world location of that X,Y value
Vector3f worldCoords = display.getWorldCoordinates(screenPos, 0);
Vector3f worldCoords2 = display.getWorldCoordinates(screenPos, 1);
System.out.println( worldCoords );
// Create a ray starting from the camera, and going in the direction
// of the mouse's location
Ray mouseRay = new Ray(worldCoords, worldCoords2
.subtractLocal(worldCoords).normalizeLocal());
// Does the mouse's ray intersect the box's world bounds?
pr.clear();
buildingsNode.findPick(mouseRay, pr);
//for (int i = 0; i < pr.getNumber(); i++) {
// pr.getPickData(i).getTargetMesh(tempNode);
pr.getPickData(0).getTargetMesh().setRenderState(ts);
pr.getPickData(0).getTargetMesh().updateRenderState();
PickData target = pr.getPickData( 0 );
tempNode = (Node) target.getTargetMesh().getParent();
Could any1 please explain why my version doesnt work or a way to find the pickdata meshs node its linked to pls?