SA-MP Forums Archive
GetPlayerCameraAspectRatio inaccurate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP (https://sampforum.blast.hk/forumdisplay.php?fid=3)
+--- Forum: Bug Reports (https://sampforum.blast.hk/forumdisplay.php?fid=20)
+--- Thread: GetPlayerCameraAspectRatio inaccurate (/showthread.php?tid=597368)



GetPlayerCameraAspectRatio inaccurate - IllidanS4 - 30.12.2015

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


Re: GetPlayerCameraAspectRatio inaccurate - DRIFT_HUNTER - 04.01.2016

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)


Re: GetPlayerCameraAspectRatio inaccurate - Crayder - 04.01.2016

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.


Re: GetPlayerCameraAspectRatio inaccurate - RoboN1X - 04.01.2016

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)


Re: GetPlayerCameraAspectRatio inaccurate - Crayder - 04.01.2016

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.


Re: GetPlayerCameraAspectRatio inaccurate - IllidanS4 - 18.12.2016

I've done some minor research, and I have found three possibilities for the return value: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.