This is how to click on something, get the thing’s coordinates and see what you clicked on.
public void onAnalog(String action, float value, int modifier, float tpf){
float intensity = value;
//System.out.println("InputState.onAnalog()" + " (action=" + action + ", value=" + value + ", modifier=" + modifier + ", tpf=" + tpf + ")");
if (action.equals(MAPPING_ROTATE)){
//System.out.println("onAnalog-mapping_rotate");
if (camera != null){
CollisionResults results = new CollisionResults();
Vector2f click2d;
click2d = inputManager.getCursorPosition();
Vector3f click3d = camera.getWorldCoordinates(new Vector2f(click2d.getX(), click2d.getY()), 0f);
Vector3f dir = camera.getWorldCoordinates(new Vector2f(click2d.getX(), click2d.getY()), 1f);
Ray ray = new Ray(click3d, dir);
rootNode.collideWith(ray, results);
if (results.size() > 0){
Geometry target = results.getClosestCollision().getGeometry();
System.out.println("InputState.onAnalog()" + ", target=" + target + ", target's parent=" + target.getParent());
}
}//if cam
}//end mapping rotate
}
};
Is this what you want? Otherwise it’s:
> rootNode
> \Sun (0, 0, 0)- local coordinates and world coordinates are the same
> \ Earth (150,000,000 km, 0, 0) around Sun; Earth local coordinate = (150,000,000 km, 0, 0), Earth world coordinate = Sun plus Earth = (150,000,000 km, 0, 0)
> \moon (385,000 km, 0, 0): Moon local coordinates - (385,000, 0, 0), Moon world coordinates (150,385,000, 0, 0)