Picking - shooting ray from arbitrary position in screen

The picking demo shoots rays from the center of the screen, from the position of the camera to its target. I want to be able to click anywhere in the screen and shoot a ray from there and perform picking with this ray. I just found that I cant get the cursor position where the user clicked in the ActionListener for mouse clicks, otherwise I would be able to code it myself (compute the ray). Then how can I do it?


You can get the cursor position by using RawInputListener and InputManager.addRawInputListener()

Ok thanks, I think that is what I need. Anyway I can’t get the mouse cursor position in the onMouseButtonEvent. I think it is useful and should be included in the MouseButtonEvent class.

You can store the cursor position on the onMouseMove() event. There’s no coordinates given in mouse button, since the input is “raw” …