Fix "Wrong Direction" message

This commit is contained in:
nixt 2014-08-01 04:01:28 +05:30
parent fbf002bfc6
commit f40fb50386

View File

@ -866,8 +866,10 @@ void LinearWorld::checkForWrongDirection(unsigned int i)
return;
// check if the player is going in the wrong direction
float angle_diff = kart->getHeading() -
m_track->getAngle(sector);
GraphNode& node = QuadGraph::get()->getNode(sector);
Vec3 center_line = node.getUpperCenter() - node.getLowerCenter();
float angle_diff = kart->getVelocity().angle(center_line);
if(angle_diff > M_PI) angle_diff -= 2*M_PI;
else if (angle_diff < -M_PI) angle_diff += 2*M_PI;
// Display a warning message if the kart is going back way (unless