diff options
| author | fisted <van.fisted@googlemail.com> | 2011-01-18 06:50:24 +0100 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2011-01-20 00:15:18 +0100 |
| commit | 372b62566b15bbcf79e3320d6daf751e04b7e501 (patch) | |
| tree | d1123b210f1cd36014d6c1c9e3f742415e012434 /src/game/gamecore.cpp | |
| parent | 17012416369663cdd5bdeead537faede3b8b308d (diff) | |
| download | zcatch-372b62566b15bbcf79e3320d6daf751e04b7e501.tar.gz zcatch-372b62566b15bbcf79e3320d6daf751e04b7e501.zip | |
fixed tower bug
Diffstat (limited to 'src/game/gamecore.cpp')
| -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 |