new implementation for cakes that doesn't rely on drivelines
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2352 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
2948a48f44
commit
2ab2e98fae
@ -146,15 +146,14 @@ void Flyable::getClosestKart(const Kart **minKart, float *minDistSquared,
|
||||
if(inFrontOf != NULL)
|
||||
{
|
||||
// Ignore karts behind the current one
|
||||
// FIXME - needs an implementation that doesn't rely on drivelines
|
||||
LinearWorld* lworld = dynamic_cast<LinearWorld*>(RaceManager::getWorld());
|
||||
if(lworld != NULL)
|
||||
{
|
||||
float distance = lworld->getDistanceDownTrackForKart( kart->getWorldKartId() ) -
|
||||
lworld->getDistanceDownTrackForKart( inFrontOf->getWorldKartId() );
|
||||
if(distance<0) distance += RaceManager::getTrack()->getTrackLength();
|
||||
if(distance > 50){ continue; }
|
||||
}
|
||||
btVector3 to_target = inFrontOf->getXYZ()-kart->getXYZ();
|
||||
const float distance = to_target.length();
|
||||
if(distance > 50) continue; // kart too far, don't aim at it
|
||||
|
||||
float angle = to_target.angle(-inFrontOf->getVelocity());
|
||||
|
||||
if(fabsf(angle) > 1) continue;
|
||||
|
||||
}
|
||||
|
||||
if(distance2 < *minDistSquared || *minDistSquared < 0 /* not yet set */)
|
||||
|
Loading…
x
Reference in New Issue
Block a user