Horizontal Movement Formulas/en: Difference between revisions

From Minecraft Parkour Wiki
Content added Content deleted
(Updating to match new version of source page)
 
(Updating to match new version of source page)
 
(2 intermediate revisions by the same user not shown)
Line 16: Line 16:




::<math>M_{t} = \begin{Bmatrix}1.3 & \textrm{Sprinting} \\ 1.0 & \textrm{Walking}\\ 0.3 & \textrm{Sneaking}\\ 0.0 & \textrm{Stopping} \end{Bmatrix} \times \begin{Bmatrix}0.98 & \textrm{Default}\\ 1.0 & \textrm{45° Strafe} \\ 0.98 \sqrt{2} & \textrm{45° Sneak} \end{Bmatrix}</math>
::<math>M_{t} = \begin{Bmatrix}1.3 & \textrm{Sprinting} \\ 1.0 & \textrm{Walking}\\ 0.3 & \textrm{Sneaking}\\ 0.0 & \textrm{Stopping} \end{Bmatrix} \times \begin{Bmatrix}0.98 & \textrm{Default}\\ 1.0 & 45^{\circ}~\textrm{Strafe} \\ 0.98 \sqrt{2} & 45^{\circ}~\textrm{Sneak} \end{Bmatrix}</math>




Line 22: Line 22:




::<math>E_{t} = (\underset{Decreases \; by \; 15\% \; per \; level \; of \; Slowness}{\underset{Increases \; by \; 20\% \; per \; level \; of \; Speed}{\underbrace{\left ( 1 + 0.2\times Speed \right ) \: \times\: \left ( 1 - 0.15\times Slowness \right )}}} \geq 0</math>
::<math>E_{t} = \underset{Decreases ~ by ~ 15\% ~ per ~ level ~ of ~ Slowness}{\underset{Increases ~ by ~ 20\% ~ per ~ level ~ of ~ Speed}{\underbrace{\left ( 1 + 0.2\times Speed \right ) ~ \times ~ \left ( 1 - 0.15\times Slowness \right )}}} \geq 0</math>




Line 45: Line 45:
:'''Ground Speed''':
:'''Ground Speed''':


::<math>V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} </math>
::<math>V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} ~ + ~ \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}}</math>




:'''Jump Speed''':
:'''Jump Speed''':


::<math>V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} + \underset{Sprintjump \; Boost}{\underbrace{\begin{Bmatrix}0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} }}</math>
::<math>V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} ~ + ~ \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} + \underset{Sprintjump ~ Boost}{\underbrace{\begin{Bmatrix}0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} }}</math>




:'''Air Speed''':
:'''Air Speed''':


::<math>V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{\underset{ }{0.02 \times M_{t}}}} </math>
::<math>V_{H,t} = \underset{Momentum}{\underbrace{\underset{ }{V_{H,t-1} \times S_{t-1} \times 0.91 }}} ~ + ~ \underset{Acceleration}{\underbrace{\underset{ }{0.02 \times M_{t}}}} </math>




Line 76: Line 76:
:'''Ground Velocity''':
:'''Ground Velocity''':


::<math>V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } \: + \: 0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3} \times \sin (D_{t}) </math>
::<math>V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } ~ + ~ 0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3} \times \sin (D_{t}) </math>
::<math>V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} \times \cos (D_{t}) </math>
::<math>V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} ~ + ~ \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} \times \cos (D_{t}) </math>


:'''Jump Velocity''':
:'''Jump Velocity''':


::<math>V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } \: + \: 0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3} \times \sin (D_{t}) + \begin{Bmatrix} 0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} \times \sin (F_{t}) </math>
::<math>V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } ~ + ~ 0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3} \times \sin (D_{t}) + \begin{Bmatrix} 0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} \times \sin (F_{t}) </math>
::<math>V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} \times \cos (D_{t}) + \underset{Sprintjump \; Boost }{\underbrace{\begin{Bmatrix} 0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} \times \cos (F_{t})}} </math>
::<math>V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} ~ + ~ \underset{Acceleration}{\underbrace{0.1 \times M_{t} \times E_{t} \times \left (\frac{0.6}{S_{t}} \right )^{3}}} \times \cos (D_{t}) + \underset{Sprintjump ~ Boost }{\underbrace{\begin{Bmatrix} 0.2 & \textrm{Sprinting}\\ 0.0 & \textrm{Else}\end{Bmatrix} \times \cos (F_{t})}} </math>


:'''Air Velocity''':
:'''Air Velocity''':


::<math>V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } \: + \: 0.02 \times M_{t} \times \sin (D_{t}) </math>
::<math>V\displaystyle _{X,t} = \underset{ }{V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 } ~ + ~ 0.02 \times M_{t} \times \sin (D_{t}) </math>
::<math>V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} \: + \: \underset{Acceleration}{\underbrace{\underset{}{0.02 \times M_{t}}}} \times \cos (D_{t}) </math>
::<math>V\displaystyle _{Z,t} = \underset{Momentum}{\underbrace{\underset{ }{V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 }}} ~ + ~ \underset{Acceleration}{\underbrace{\underset{}{0.02 \times M_{t}}}} \times \cos (D_{t}) </math>




Line 97: Line 97:
:'''Wall Collision''':
:'''Wall Collision''':


::If the player hits a X-facing wall, then momentum is cancelled and <math display="inline">V\displaystyle _{X,t}</math> only includes acceleration.
::If the player hits a X-facing wall, then momentum is cancelled, and <math display="inline">V\displaystyle _{X,t}</math> only includes acceleration.
::If the player hits a Z-facing wall, then momentum is cancelled and <math display="inline">V\displaystyle _{Z,t}</math> only includes acceleration.
::If the player hits a Z-facing wall, then momentum is cancelled, and <math display="inline">V\displaystyle _{Z,t}</math> only includes acceleration.
::In either of these case, the player stops sprinting.
::In either of these case, the player stops sprinting.


Line 105: Line 105:
:'''Negligible Speed Threshold''':
:'''Negligible Speed Threshold''':


::If <math display="inline"> \left | V\displaystyle _{X,t} \times S_{t} \times 0.91 \right | < 0.005 </math> , momentum is cancelled and only the acceleration is left.
::If <math display="inline"> \left | V\displaystyle _{X,t-1} \times S_{t-1} \times 0.91 \right | < 0.005, </math> then momentum is cancelled, and only the acceleration is left.
::If <math display="inline"> \left | V\displaystyle _{Z,t} \times S_{t} \times 0.91 \right | < 0.005 </math> , momentum is cancelled and only the acceleration is left.
::If <math display="inline"> \left | V\displaystyle _{Z,t-1} \times S_{t-1} \times 0.91 \right | < 0.005, </math> then momentum is cancelled, and only the acceleration is left.


::In 1.9+, they are compared to 0.003 instead.
::In 1.9+, they are compared to 0.003 instead.

Latest revision as of 09:06, 26 December 2023

Other languages:

On every tick, the game does these three steps:

  1. Acceleration is added to the player's velocity.
  2. The player is moved (new position = position + velocity).
  3. The player's velocity is reduced to simulate drag.

We'll start by introducing Multipliers in an effort to make formulas more readable.


Multipliers

Movement Multiplier (See 45° Strafe)



Effects Multiplier (See Status Effects)



Slipperiness Multiplier (See Slipperiness)



Linear Formulas

These simplified formulas only apply to linear movement (no change in direction). While this condition might seem very restrictive, these formulas are very useful to analyze conventional jumps and momentum We'll later expand on these formulas by including angles.


Definition:
  • is the player's initial speed (default = 0).
  • is the player's speed on tick .


Ground Speed:


Jump Speed:


Air Speed:


Complete Formulas

Let's introduce two more variables:

  • , The player's Direction in degrees (defined by their inputs and rotation)
  • , The player's Facing in degrees (defined by their rotation only)


In reality, angles aren't as simple as that, as there are a limited number of significant angles (see Facing and Angles).

For the purpose of simplicity, we'll ignore this fact.


Definition:
  • and correspond to the player's initial velocity.
  • and correspond to the player's velocity on tick

Ground Velocity:
Jump Velocity:
Air Velocity:


Stopping Conditions

Horizontal speed is set to 0 if the player hits a wall, or if the speed is considered to be negligible.


Wall Collision:
If the player hits a X-facing wall, then momentum is cancelled, and only includes acceleration.
If the player hits a Z-facing wall, then momentum is cancelled, and only includes acceleration.
In either of these case, the player stops sprinting.


Negligible Speed Threshold:
If then momentum is cancelled, and only the acceleration is left.
If then momentum is cancelled, and only the acceleration is left.
In 1.9+, they are compared to 0.003 instead.


Source Code

[...]