Removed 'very clever' logic (to avoid trying to collect items that

are too far out of our way) ... which only resulted in the AI not
being able to decide which of two items to pick, and then driving
left/right/left ... till it missed both items.


git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11552 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-09-05 06:56:49 +00:00
parent 0f17674e1e
commit be34f742e7

View File

@@ -960,7 +960,7 @@ void SkiddingAI::evaluateItems(const Item *item, float kart_aim_angle,
// so 0 means straight ahead in world coordinates!).
const Vec3 &xyz = item->getXYZ();
float item_angle = atan2(xyz.getX() - m_kart->getXYZ().getX(),
xyz.getZ() - m_kart->getXYZ().getZ());
xyz.getZ() - m_kart->getXYZ().getZ());
float diff = normalizeAngle(kart_aim_angle-item_angle);
@@ -981,14 +981,6 @@ void SkiddingAI::evaluateItems(const Item *item, float kart_aim_angle,
if(fabsf(diff) > max_angle)
return;
float steer_direction = normalizeAngle(m_kart->getHeading()
- kart_aim_angle );
float item_direction = normalizeAngle(m_kart->getHeading()
- item_angle );
// If we have to steer to the left, and the item is to the right
// or vice versa, ignore the item.
if(!avoid && (steer_direction * item_direction < 0) )
return;
} // if !avoid
// Now insert the item into the sorted list of items to avoid