Fix conformPedRotation drift while ped is moving forwards#5015
Open
QueryOfficial wants to merge 1 commit into
Open
Fix conformPedRotation drift while ped is moving forwards#5015QueryOfficial wants to merge 1 commit into
QueryOfficial wants to merge 1 commit into
Conversation
- Implemented `ReapplyScriptRotations` in `CClientPedManager` to update ped rotations when the game is loaded. - Added `SetScriptRotationOverride` and `ReapplyScriptRotationIfNeeded` methods in `CClientPed` to manage script rotation states. - Updated `CClientGame` to call `ReapplyScriptRotations` during post-world processing. - Ensured script rotation overrides are cleared when a ped enters a vehicle. This change enhances the accuracy of ped rotations in the game environment, addressing potential desynchronization issues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Re-apply script-set ped rotation after GTA movement tasks overwrite it each frame.
When
setElementRotation/setPedRotation(or serverSET_PED_ROTATION) sets ped rotation, the client now stores that value and restores it at the start ofPostWorldProcessHandler, afterProcessPedsAfterPreRender, and before puresync/keysync writes. This keepsconformPedRotation=truestable while the ped is walking on foot and stops remote players from flickering between two rotations.Motivation
Fixes #4694
GTA’s on-foot movement task adjusts ped heading every frame (e.g. ~5° drift while
forwardsis held). Script rotation set inonClientPreRenderwas overwritten before the next frame and before network sync, sogetElementRotationshowed a different value and remote clients saw alternating rotations.This follows the same idea as frozen ped matrix re-apply: persist the script value and restore it after the engine has run.
Test plan
onClientPreRender,setPedControlState(localPlayer, "forwards", true),setElementRotation(localPlayer, 0, 0, rot, "default", true)— reddifftext should not appear (or stay ≤1°)setElementFrozenped rotation sync still works (regression check for Fix ped rotation sync is broken when using setElementFrozen instantly #4566)./utils/clang-format.ps1on changed C++ filesChecklist