When aiming at the closest kart, prefer karts on similar Y levels to karts much higher or much below

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@8597 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-05-15 23:42:21 +00:00
parent 4e85539c21
commit 344c89e258

View File

@ -259,7 +259,8 @@ void Flyable::getClosestKart(const Kart **minKart, float *minDistSquared,
btTransform t=kart->getTrans();
Vec3 delta = t.getOrigin()-tProjectile.getOrigin();
float distance2 = delta.length2();
// the Y distance is added again because karts above or below should not be prioritized when aiming
float distance2 = delta.length2() + abs(t.getOrigin().getY() - tProjectile.getOrigin().getY())*2;
if(inFrontOf != NULL)
{