diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Movement/Spline/MoveSpline.cpp | 2 | ||||
-rw-r--r-- | src/server/game/Movement/Spline/MovementUtil.cpp | 19 |
2 files changed, 11 insertions, 10 deletions
diff --git a/src/server/game/Movement/Spline/MoveSpline.cpp b/src/server/game/Movement/Spline/MoveSpline.cpp index 04c88c784ed..748ae1221ce 100644 --- a/src/server/game/Movement/Spline/MoveSpline.cpp +++ b/src/server/game/Movement/Spline/MoveSpline.cpp @@ -24,7 +24,7 @@ namespace Movement{ extern float computeFallTime(float path_length, bool isSafeFall); -extern float computeFallElevation(float time_passed, bool isSafeFall, float start_velocy); +extern float computeFallElevation(float time_passed, bool isSafeFall, float start_velocity); extern float computeFallElevation(float time_passed); Location MoveSpline::ComputePosition() const diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp index 3531b629454..ae85b63e113 100644 --- a/src/server/game/Movement/Spline/MovementUtil.cpp +++ b/src/server/game/Movement/Spline/MovementUtil.cpp @@ -30,8 +30,9 @@ namespace Movement float terminalSafefallVelocity = 7.0f; const float terminal_length = float(terminalVelocity * terminalVelocity) / (2.0f * gravity); - const float terminal_safefall_length = (terminalSafefallVelocity * terminalSafefallVelocity) / (2.0f * gravity); - const float terminalFallTime = float(terminalVelocity / gravity); // the time that needed to reach terminalVelocity + const float terminal_safeFall_length = (terminalSafefallVelocity * terminalSafefallVelocity) / (2.0f * gravity); + const float terminal_fallTime = float(terminalVelocity / gravity); // the time that needed to reach terminalVelocity + const float terminal_safeFall_fallTime = float(terminalSafefallVelocity / gravity); // the time that needed to reach terminalVelocity with safefall float computeFallTime(float path_length, bool isSafeFall) { @@ -41,15 +42,15 @@ namespace Movement float time; if (isSafeFall) { - if (path_length >= terminal_safefall_length) - time = (path_length - terminal_safefall_length) / terminalSafefallVelocity + terminalSafefallVelocity / gravity; + if (path_length >= terminal_safeFall_length) + time = (path_length - terminal_safeFall_length) / terminalSafefallVelocity + terminalSafefallVelocity / gravity; else time = sqrtf(2.0f * path_length / gravity); } else { if (path_length >= terminal_length) - time = (path_length - terminal_length) / terminalVelocity + terminalFallTime; + time = (path_length - terminal_length) / terminalVelocity + terminal_fallTime; else time = sqrtf(2.0f * path_length / gravity); } @@ -70,11 +71,11 @@ namespace Movement if (start_velocity > termVel) start_velocity = termVel; - float terminal_time = terminalFallTime - start_velocity / gravity; // the time that needed to reach terminalVelocity + float terminal_time = (isSafeFall ? terminal_safeFall_fallTime : terminal_fallTime) - start_velocity / gravity; // the time that needed to reach terminalVelocity if (t_passed > terminal_time) { - result = terminalVelocity * (t_passed - terminal_time) + + result = termVel * (t_passed - terminal_time) + start_velocity * terminal_time + gravity * terminal_time * terminal_time*0.5f; } @@ -88,11 +89,11 @@ namespace Movement { float result; - if (t_passed > terminalFallTime) + if (t_passed > terminal_fallTime) { //result = terminalVelocity * (t_passed - terminal_time) + gravity*terminal_time*terminal_time*0.5f; // simplified view: - result = terminalVelocity * (t_passed - terminalFallTime) + terminal_length; + result = terminalVelocity * (t_passed - terminal_fallTime) + terminal_length; } else result = t_passed * t_passed * gravity * 0.5f; |