I want to find the four corners of the camera's viewing area as GPS positions so I can draw the camera's view on the globe. As I said, if I can get the Cartesian coords then I can do the conversion to GPS. Here's what I have so far.
- Convert camera position and line of sight to Cartesian coords.
- Calculate the camera's direction vector: losPosition - cameraPosition
- For each corner, rotate the direction vector by half the field of view in each direction
- Use the camera point and rotated direction vector as a ray; do a raycast into earth geometry
- Convert collision point back into GPS position
When I draw the resulting bounding box, it's in the right area on the globe, but the shape is totally wrong. My guess is that I need to rotate the rays around the plane's up/forward/right axes instead of the world axes. Am I on the right track? If so, is there an easy way to find those axes? Can you think of an easier, or even just different, approach to this problem?