Player: Difference between revisions

2 bytes removed ,  1 November 2024
Tags: Undo Mobile edit Advanced mobile edit
Line 189:
== Movement speed ==
 
There isn't a simple hard-coded maximum velocity for walking, sprinting, etc. The maximum is a result of a base acceleration countered by "friction" or air resistance. The base acceleration for walking is 0.098, and sprinting is 30% faster than that. Velocity is increased by this acceleration value every tick (1/20th of a second), then the player is moved by the resulting velocity, then the velocity is multiplied by the friction value of the block they are walking on. For most blocks, the friction value is 0.546. As the player walks forward, each tick their velocity goes +0.098, *0.546, +.098, *0.546, +0.098, and so on. The a result is that eventually, the 0.546 multiplier counteracts the 0.098 increase, so the player doesn't go any faster. The formula for this "terminal velocity" is a/(1-r), where a is the acceleration, and r is the block's friction. 0.098/(1-0.546) ≈ 0.2159 meters/tick = 4.317 meters/second. Sprinting is 30% faster than that, at about 5.612 meters/second. Flying is similar, but the base acceleration is 0.049 and the "friction" is 0.91, which comes out to ~10.89 m/s.
 
{|class="wikitable" data-description="Movement speed by method, unassisted"
165

edits