Closed Mathu-lmn closed 4 days ago
https://github.com/citizenfx/fivem/assets/80094438/162de2b8-c3c0-4743-a555-3d026f141fd4
Reuploading the video to allow preview :)
While this is still not working I found using GetGameplayCamRot().x worked to get the cam pitch.
The sequence does look a bit counter-intuitive w/ BaseOrbitPitchOffset
, ExtraOrbitPitchOffset
(controlled via undocumented natives), LookOverSettings
, and whatever else (the entity) having an effect on the 'relative' pitch after the call to SetGameplayCamRelativePitch
.
This seems more like a documentation bug. If you truly require absolute-zero, you could, I guess, compensate in the other direction (e.g., +2.046 in your example).
Hey, the issue here is I have no way to determine the "offset", depending on where I am on the map, it can either be -2.2, -0.9 or anything in between. But I'll try @Infinity585 's suggestion tho.
Any updates w/ what was suggested? Otherwise, may I close this issue?
Hey, I just tested this right now again, but his suggestion didn't work either :/
After further investigation, it seems that setting the player's heading to 0.0 "fixes" the getter offset
Okay it doesn't seems related then.... I don't understand those offsets
With third-person cameras it does seem like "relative" here has two different meanings.
SetGameplayCamRelativePitch
, as I mentioned above, is a calculation relative to (or constrained by) its orbit configuration.GetGameplayCamRelativePitch
returns the relative pitch between the camera and whatever it is attached too (or following; just a subtraction of two angles).Hmm so it's more a naming convention issue than a game mechanic issue then. How would I get the GameplayCamRelativePitch correctly then ?
Maybe give ClampGameplayCamPitch a shot. See if this helps you achieve the effect you desire.
Okay so this actually works but there's a twist. While the ClampGameplayCamPitch native is called each frame, the GetGameplayCamRelativePitch native returns 0.0 successfully, but once the loop ends and the native stops being called each frame the getter returns the weird "random" offset again.
The thing is that I found this issue while developing a feature for a menu, when the player's mouse goes on the top or bottom edge of the screen, the camera moves. I managed to do it for the cam heading correctly, but got this issue for the pitch :/
the getter returns the weird "random" offset again.
For these specific cameras, it is not a setter/getter pair in the traditional sense. The orbit camera has its own restrictions, effects, and limitations (e.g. clipping) that supersede whatever is desired from scripting commands. ClampGameplayCamPitch
is just a hack to "force" things to be the way you want.
Client (production/canary) and FXServer version Beta client, 6683 artifacts (windows)
What you expected to happen When setting the gameplay cam relative pitch to 0.0, using the associated getter would return 0.0 if I'm not moving the camera
What actually happens There seems to be an offset depending on the ped world coords
Category of bug (eg. client, server, weapons, peds, native) Camera natives / client side
Reproducible steps, preferably with example script(s)
Video