I'm having some issues with picking in parallel projection mode. I think I'm doing something really dumb…and need some help.
I'm setting up the camera using the following code.
DisplaySystem display = DisplaySystem.getDisplaySystem();
Camera cam = display.getRenderer().getCamera();
float aspect = (float) display.getWidth() / display.getHeight();
-20.0f * aspect,
20.0f * aspect,
I'm then trying to pick the results with the following code:
Vector2f screenPos = new Vector2f();
// Get the position that the mouse is pointing to
// Get the world location of that X,Y value
Vector3f worldCoords = DisplaySystem.getDisplaySystem()
// Get the camera
Camera cam = DisplaySystem.getDisplaySystem()
// Create a ray starting from the camera, and going in the direction
// of the mouse's location
Ray mouseRay = new Ray(DisplaySystem.getDisplaySystem().getWorldCoordinates(screenPos, 0.0f),
I calculate the mouse pick all the time (I know this can slow it down...) and what I'm noticing is that it is picking objects and triangle that the absolute mouse is not hovering over.
If I change the frustrums start positions, the issue gets more and more exaggerated. I'm curious as to what I'm doing wrong. I would think that the Ray would shoot directly out, but it looks like it is almost in a 'perspective' mode.
Any ideas what I'm doing wrong?