In Virtual Reality, I'm trying to position a 3D plane at the exact physical position of my monitor. The end goal is to be able to use my Touch controller as a light gun which can shoot targets on my physical monitor.
Before playing, the player has to record the position of their screen in VR space. I figured the smartest way to do this is to use the Touch controller to record the four corner points of the monitor. Surprisingly, this worked.
So then I had four XYZ positions representing the four corners.
I have found the length of the screen by calculating the length between the upper-right and upper-left corner, using GetVector3Distance()
Likewise with the height of the screen.
And the screen's location seems to just be the average of the four corners.
But wait, how do I figure out the screens angle?
I have the XYZ position of each of the four corners. So I got plenty of data. But how exactly do I extract an angle from that?
And then ... I have to figure out how to shoot a ray from the Touch controller towards the plane, and convert the hit position to the XY position on my monitor.
Again, I got plenty of data, but I'm afraid I have to use math here. Trigonometry, the worst math! Help!