I’m currently working through the tutorials on the github, and am currently at Hello Picking. At some point, the tutorial explains how to point and click in a 3D model using your mouse. For this, they give a code, and tell you to also use
inputManager.setCursorVisible(true). They also explain that it is now not possible to move the camera using the mouse.
Changing the code doesn’t give an error, but I cannot seem to find the code where I have to put
inputManager.setCursorVisible(true). The only place where it works in is
public void onAction, where the mouse becomes visible after clicking once. Even when using this code, the camera still moves by moving the mouse, however.
Where do I have to put this line of code, and do I have to manually disable the camera moving by the mouse?
Here the code that I changed it into:
// 1. Reset results list. CollisionResults results = new CollisionResults(); 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); shootables.collideWith(ray, results); // 4. Print the results System.out....
Thanks in advance!