You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 19, 2018. It is now read-only.
The Minecraft client polls the mouse and adjusts the player's view angles in a very peculiar way.
This assumes smooth aim is off.
On Frame
Poll the mouse to see how many pixels it has moved on the x (horizontal) and y (vertical) axes.
I will refer to the pixel movement on x and y as dx and dy respectively.
The player's sensitivity ranges from 0.0 (yawn) to 1.0 (hyperspeed). 0.5 is the default sensitivity (100%). I will refer to this as s.
The procedure to update the player's angles is as follows:
s = 0.6s + 0.2
s = s^3 * 8.0
dx *= s
dy *= s
if (invert mouse is enabled)
dy *= -1
player.yaw += dx * 0.15
player.pitch -= dy * 0.15
if player.pitch > 90
player.pitch = 90
if player.pitch < -90
player.pitch = -90