GetPlayerCameraAspectRatio inaccurate
#1

Using GetPlayerCameraAspectRatio on my game results in 1.333333, while my resolution is 1280x1024, clearly 1.25. Why is that?
Reply
#2

GetPlayerCameraAspectRatio is actually to detect if player has widescreen turned on. 1.333 i think means its not on. When i say widescreen i mean option for graphics (the one you setup in main menu of GTA)
Reply
#3

Quote:
Originally Posted by DRIFT_HUNTER
View Post
GetPlayerCameraAspectRatio is actually to detect if player has widescreen turned on. 1.333 i think means its not on. When i say widescreen i mean option for graphics (the one you setup in main menu of GTA)
No. Not exactly. It CAN be used to detect widescreen, but that is NOT what is is made for.

@OP: My laptop is 1280x1024 too, and I'm pretty sure it returns 1.25 for me. It must be something to do with your settings and such.
Reply
#4

I tried this,
640x480 = 1.333333 (lowest)
720x480 = 1.333333 (incorrect)
720x576 = 1.333333 (incorrect)
800x600 = 1.333333
1024x768 = 1.333333
1152x864 = 1.333333
1280x720 = 1.333333
1280x800 = 1.333333 (incorrect)
1280x960 = 1.333333
1280x1024 = 1.333333 (max, incorrect)
The values are same, but when i enable widescreen it's changed to: 1.776470

I'm not sure, either it returns the lowest value available in option (640x480 = 1.333333 = 4:3), or the most ones (4:3),
instead of max/native resolution for my display (1280x1024 = 1.25 = 5:4)
Reply
#5

That's definitely weird. Before I know it worked, I had used it on multiple monitors at every resolution I could when I was testing the ScreenToWorld include improvements.
Reply
#6

I've done some minor research, and I have found three possibilities for the return value:
  • 4:3 (1.3333334, Float:0x3FAAAAAB) - this is returned for the majority of players, when the "widescreen" option in the display settings is turned off, possibly incorrectly when they actually have a widescreen display.
  • 5:4 (1.2470589, Float:0x3F9F9FA0) - this value is returned when the letterbox mode is turned on, like via YSF's TogglePlayerWidescreen.
  • 16:9 (1.7764707, Float:0x3FE36364) - this value is returned in all cases when the "widescreen" option is turned on.
As you can see, it cannot be used to accurately detect the aspect ratio of the player's screen. However, it seems the value actually represents something close to the player's field of view, as shown by IDA:

Code:
v6 = (double)*(_BYTE *)(v4 + 30) * 0.0039215689 + 1.0;
Reversing the conversion, the actual values obtained from the player are 85, 63 and 198 respectively, for the above cases. It's not an actual field of view angle, but it does represent how large the player's field of view is.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)