SetHpr issues, pulling hair out

What I was up to is pretty simple. I have a number of objects on a plane marked with a grid. The mouse can select those objects but in order to get to their array data I need to know their position in “real” x-y-z. So knowing that the screen is a perspective view, I wrote a simple transformation that takes the mouse click, converts it into the actual coordinates of the objects, then scans their array to locate the specific thing that you wish to operate on.

It’s invisible to the user of course. They just point and click. The issue arose that when the aspect ratio of the screen changes, the ratios are all wonky. By reading the actual screen size I wrote a single correction factor that is updated at each frame and it automatically makes the numbers right again.

Cheers!

Charles