I have a x*z plane (at 0,0,0) and a camera pointing at it, in 60 degrees (and FoW of 60), at changing distance from the plane. Camera can move around, but its angle and relative position to screen (except for y/z according to distance) is static; so, if it now points to world point (0,0,0) and I want it to point to (2,0,2), I simply translate it by (2,0,2)
The problem: I need a function that takes a world coordinate “A” (x,0,z) and viewport position “V” (vx,vz) and returns coordinate where the camera needs to be moved so that after the camera translate, world coordinate “A” is in viewport position “V”. If “V” is (0.5,05), this is like normal camera targeting operation, but because of the 3D projection, translation from screen position (0.5,0.1) to (0.5,0.3) is different camera move than from (0.5,0.7) to (0.5,0.9) and so on.
Apparently this is some basic mathematic formula but the details fail me - seems like a common problem (any draggable map in perspective camera) so there must be some (semi-)ready solution in Unity…?