I have this code for ray casting from mouse pointer:
Vector2f click2d = inputManager.getCursorPosition().clone();
Vector3f click3d = cam.getWorldCoordinates( click2d, 0f).clone(); Vector3f dir = cam.getWorldCoordinates( click2d, 1f).subtractLocal(click3d).normalizeLocal(); Ray ray = new Ray(click3d, dir); g.node.collideWith(ray, results);
Now, I want to modify it so instead of the mouse pointer I have a spatial in somewhere on the screen.
What would you suggest as best practice for doing it?