Calculate mouse ray to select model

Hey all



What I want to achieve seems not that easy as I thought. I have a world and a character with a chasecamera. So if my character moves, the chasecamera moves with it. I also have enemy’s in my world that I can kill (or that’s what I want it to do) when I click on them. I can’t find way to calculate the ray that the mouse sends into my world.



The HelloPicking example just has the center of the camera as “mouse”-position. Because I have a chasecamera and I want my mouse to send the ray, not the center of the camera, I got stuck.



I use jME3 because I already found examples of jME2 but they didn’t helped me a bit.



Hopefully somebody of you can help me.







Thanks in advance

See the TestMousePick example

Thank you very much. It works!