General Rotation Question


imagine I have a scene, a camera at (0,0,10) and an object at (0,0,0). I want to rotate the object, not the camera, using my mouse. If I press the middle mouse button and drag it, the object should rotate. Of course, it should rotate “intelligently”. If I drag the mouse from the center of the screen to the right lower corner, the object should “follow”. So, if the local coordinate system of the object is equal to the world coordinate system before dragging (Object{{1,0,0},{0,1,0},{0,0,1}}==World{{1,0,0},{0,1,0},{0,0,1}}) this would mean that the y-axis is following the mouse cursor to the lower right corner.

Of course, there must be a transformation procedure from

screen coordinates → world coordinates

How would you describe such a transformation using the matrices and quaterions from JME3?



look at the camera getWorldCoordinates, it does what you want to do