Paper
Paper copied to clipboard
Player.getBodyYaw() not updating when player strafe
Expected behavior
Player bodyYaw updation after strafing without head moving, but nothing changes.
Observed/Actual behavior
When I strafe to left/right direction, visual body rotation was changed, but the Player.getBodyYaw value was same as before moving
Steps/models to reproduce
Just tap on keyboard to move your player left/right
Plugin and Datapack List
Only what I've written for testing.
Paper version
This server is running Paper version git-Paper-477 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: 5c78e77) Previous version: git-Paper-404 (MC: 1.19.3)
Other
Additionally: BodyYaw value can grow below -180 and higher than +180
how can I contribute to this issue?
replicable on latest build
from a v quick look, issue is nms entity move functions don't appear to update yBodyRot
- api impl appears to be primarily for vehicles
If the 'bodyYaw' value is not updating correctly after strafing. This could be because the 'bodyYaw' value is not being updated in the Entity class when the player strafes. We can create a custom event listener that listens for the player's movement and updates the bodyYaw value accordingly. This listener listens for PlayerMoveEvents and updates the player's yaw and bodyYaw values based on the change in the player's position. And we use atan2(-deltaX, deltaZ) to ensure that the rotation is correct regardless of the player's direction of movement.
If the 'bodyYaw' value is not updating correctly after strafing. This could be because the 'bodyYaw' value is not being updated in the Entity class when the player strafes. We can create a custom event listener that listens for the player's movement and updates the bodyYaw value accordingly. This listener listens for PlayerMoveEvents and updates the player's yaw and bodyYaw values based on the change in the player's position. And we use atan2(-deltaX, deltaZ) to ensure that the rotation is correct regardless of the player's direction of movement.
This is not a good solution for me, required solution will update a lot of data depends on bodyYaw, checking move event will ensure a big impact to performance.