Skip to content

Commit

Permalink
player/player.go: Move: Use Rotation.Add to ensure rotation is always…
Browse files Browse the repository at this point in the history
… corrected to be within bounds.
  • Loading branch information
Sandertv committed Dec 22, 2024
1 parent 227e258 commit 620235a
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions server/player/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -2017,8 +2017,7 @@ func (p *Player) Move(deltaPos mgl64.Vec3, deltaYaw, deltaPitch float64) {
}
var (
pos = p.Position()
yaw, pitch = p.Rotation().Elem()
res, resRot = pos.Add(deltaPos), cube.Rotation{yaw + deltaYaw, pitch + deltaPitch}
res, resRot = pos.Add(deltaPos), p.Rotation().Add(cube.Rotation{deltaYaw, deltaPitch})
)
ctx := event.C(p)
if p.Handler().HandleMove(ctx, res, resRot); ctx.Cancelled() {
Expand Down

0 comments on commit 620235a

Please sign in to comment.