diff options
Diffstat (limited to 'src/game')
| -rw-r--r-- | src/game/gamecore.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/game/gamecore.cpp b/src/game/gamecore.cpp index c3c29537..629b32e8 100644 --- a/src/game/gamecore.cpp +++ b/src/game/gamecore.cpp @@ -320,13 +320,15 @@ void CCharacterCore::Tick(bool UseInput) if(d < PhysSize*1.25f && d > 1.0f) { float a = (PhysSize*1.45f - d); - + float v = 0.5f; + // make sure that we don't add excess force by checking the - // direction against the current velocity - vec2 VelDir = normalize(m_Vel); - float v = 1-(dot(VelDir, Dir)+1)/2; - m_Vel = m_Vel + Dir*a*(v*0.75f); - m_Vel = m_Vel * 0.85f; + // direction against the current velocity. if not zero. + if (length(m_Vel) > 0.0001) + v = 1-(dot(normalize(m_Vel), Dir)+1)/2; + + m_Vel += Dir*a*(v*0.75f); + m_Vel *= 0.85f; } // handle hook influence |