Make game playable when start racing

This commit is contained in:
Benau 2016-04-08 15:44:50 +08:00
parent 6dc05a1ec7
commit d914e1eea3
2 changed files with 4 additions and 8 deletions

View File

@ -880,9 +880,9 @@ void LinearWorld::checkForWrongDirection(unsigned int i, float dt)
Vec3 center_line = node.getUpperCenter() - node.getLowerCenter();
float angle_diff = kart->getVelocity().angle(center_line);
if (angle_diff > M_PI)
if (angle_diff > M_PI)
angle_diff -= 2*M_PI;
else if (angle_diff < -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

View File

@ -2388,15 +2388,13 @@ const core::vector3df& Track::getSunRotation()
bool Track::findGround(AbstractKart *kart)
{
btVector3 to(kart->getXYZ());
Vec3 quadNormal;
Vec3 quadNormal(0, 1, 0);;
if (QuadGraph::get())
{
unsigned int sector = ((LinearWorld*)World::getWorld())->getTrackSector(kart->getWorldKartId()).getCurrentGraphNode();
int sector = ((LinearWorld*)World::getWorld())->getTrackSector(kart->getWorldKartId()).getCurrentGraphNode();
if (sector != QuadGraph::UNKNOWN_SECTOR)
quadNormal = QuadGraph::get()->getQuadOfNode(sector).getNormal();
}
else
quadNormal = Vec3(0, 1, 0);
to = to + -1000.0f*quadNormal;
@ -2434,9 +2432,7 @@ bool Track::findGround(AbstractKart *kart)
return false;
}
btTransform t = kart->getBody()->getCenterOfMassTransform();
btQuaternion q = t.getRotation();
// The computer offset is slightly too large, it should take
// the default suspension rest instead of suspension rest (i.e. the
// length of the suspension with the weight of the kart resting on