• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[vJASS] Mouse Screen Position: Field of View

Status
Not open for further replies.
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:
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:
No real solution idea, only that the cam's view isn't a rect, but more like a trapeze and depending like cam's AngleOfAttack. Scrolling with mouse for example could extremely change the discprepancy. And it's probably why there isn't a native to get such min/max values.

You could try to calculate the AoA discrepancy, and then yes, too, also probably FoA needs to be considered for each player. And also then, not sure it would work flawlessly. :/
 
Status
Not open for further replies.
Top