Fix Player Model HUD corrupting entity head rotation#6514
Open
FabiFNA wants to merge 1 commit into
Open
Conversation
## Type of change - [x] Bug fix ## Description `HudRenderer.entity()` temporarily overwrites the rendered entity's rotation fields to pose the Player Model HUD element, then restores them. The restore of the head-yaw fields was swapped: - `yHeadRot` (current) was restored from the saved *previous* value - `yHeadRotO` (previous) was restored from the saved *current* value So every frame the element is drawn, the entity's current and previous head yaw are exchanged, corrupting the head-rotation interpolation used by the world renderer. `yBodyRot` is restored correctly, so only head rotation is affected. This restores each field to its own saved value. ## Related issues None linked — reproducible whenever the Player Model HUD element is enabled. # How Has This Been Tested? With the Player Model element enabled, head/body rotation visibly stutters when turning in a boat or on a horse and when looking at your own head in F5. Disabling only the Player Model element stops it. After this change the stuttering is gone and the element still renders correctly. # Checklist: - [x] My code follows the style guidelines of this project. - [x] I have added comments to my code in more complex areas. - [x] I have tested the code in both development and production environments.
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.
Type of change
Description
HudRenderer.entity()temporarily overwrites the rendered entity's rotation fields to pose the Player Model HUD element, then restores them. The restore of the head-yaw fields was swapped:yHeadRot(current) was restored from the saved previous valueyHeadRotO(previous) was restored from the saved current valueSo every frame the element is drawn, the entity's current and previous head yaw are exchanged, corrupting the head-rotation interpolation used by the world renderer.
yBodyRotis restored correctly, so only head rotation is affected. This restores each field to its own saved value.Related issues
None linked, reproducible whenever the Player Model HUD element is enabled.
How Has This Been Tested?
With the Player Model element enabled, head/body rotation visibly stutters when turning in a boat or on a horse and when looking at your own head in F5. Disabling only the Player Model element in HUD stops it. After this change the stuttering is gone and the element still renders correctly.
Checklist: