- Joined
- Nov 2, 2004
- Messages
- 1,993
There's a problem with [vJASS] - ScreenMouse where relative X values are larger at the top of the screen than at the bottom of the screen. This is because a wider area is shown the further you get away from the camera source, determined by the field of view angle. So the larger the field of view, the bigger this discrepancy gets.
I can't seem to figure out how to solve this. The best I've come up with is the following, which doesn't work:
If I'm correct, it doesn't work because I'm just adding/subtracting a flat value from difX, whereas I need to multiply by a ratio. But I can't think of a way to get that ratio.
Any ideas? Thanks.
I can't seem to figure out how to solve this. The best I've come up with is the following, which doesn't work:
JASS:
if difX > 0 then
set difX = difX - Tan(GetCameraField(CAMERA_FIELD_FIELD_OF_VIEW)/2)*difY
elseif difX < 0 then
set difX = difX + Tan(GetCameraField(CAMERA_FIELD_FIELD_OF_VIEW)/2)*difY
endif
If I'm correct, it doesn't work because I'm just adding/subtracting a flat value from difX, whereas I need to multiply by a ratio. But I can't think of a way to get that ratio.
Any ideas? Thanks.
Last edited: