Login  Register

PickRay and Camera questions...

Posted by ThomasR on Jan 29, 2018; 9:15pm
URL: https://forum.jogamp.org/PickRay-and-Camera-questions-tp4038579.html

Hi,

Camera.getPickRay() doesn't return results consistent with a new com.ardor3d.framework.Canvas after resizing the window, unless I manually resize the Camera on each componentResized event. Is this correct, or is there a better way. You can see this issue resizing the window in the ShapesExample.


How can I adjust the Camera so that aspect ratio of the scene is not altered when the user resizes the window. Unless a translations is applied to the model, the center of the window should remain aligned the the center of the world coordinate system. I tried playing with camera.resize() but I don't get the results I expect and pickRay problem above manifests itself. Does the viewport or frustum have to be adjusted?


To translate the model against mouse motion, I scale screen pixel changes to world coordinate changes at the world coordinate origin. But to do this using Camera facilities I need the normalized depth at the w.c. origin so I can use
Camera.getWorldCoordinates. My solution is to build a function zDepth -> w.c. Z at the center of the window and
interpolate. This works well, but would have to be updated anytime the camera is changed. Can you suggest a better way
using what Jogamp Ardor3D already has? Any suggestion greatly appreciated. I know I could work the model to view
tranfpormation process backward, but there must be a better way.

Tom