From 36782958a246846cf20ae0772a2a6043401dd27c Mon Sep 17 00:00:00 2001 From: hikerstk Date: Fri, 21 Jan 2011 05:41:10 +0000 Subject: [PATCH] Don't allow slipstream if one kart is much higher than the other (i.e. on a bridge). Previously only the 2d projection was considered. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7496 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/slip_stream.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/graphics/slip_stream.cpp b/src/graphics/slip_stream.cpp index 05864e5c7..26d3e4075 100644 --- a/src/graphics/slip_stream.cpp +++ b/src/graphics/slip_stream.cpp @@ -366,6 +366,12 @@ void SlipStream::update(float dt) m_target_kart->playingEmergencyAnimation() || m_target_kart->isEliminated() ) continue; + float diff = fabsf(m_target_kart->getXYZ().getY() + - m_kart->getXYZ().getY() ); + // If the kart is 'on top' of this kart (e.g. up on a bridge), + // don't consider it for slipstreaming. + + if(diff>6.0f) continue; // If the kart we are testing against is too slow, no need to test // slipstreaming. Note: We compare the speed of the other kart // against the minimum slipstream speed kart of this kart - not