fixed karts beginning in front of start line by calculating offset from drivelines instead of using arbitrary values
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@2668 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -253,6 +253,7 @@ void LinearWorld::doLapCounting ( KartInfo& kart_info, Kart* kart )
|
||||
{
|
||||
setTimeAtLapForKart( RaceManager::getWorld()->getTime(), kart->getWorldKartId() );
|
||||
kart_info.m_race_lap++ ;
|
||||
printf("lap = %i\n", kart_info.m_race_lap);
|
||||
}
|
||||
// Race finished
|
||||
if(kart_info.m_race_lap >= race_manager->getNumLaps() &&
|
||||
|
||||
@@ -435,13 +435,17 @@ btTransform Track::getStartTransform(unsigned int pos) const
|
||||
}
|
||||
else
|
||||
{
|
||||
// Bug fix/workaround: sometimes the first kart would be too close
|
||||
// sometimes the first kart would be too close
|
||||
// to the first driveline point and not to the last one -->
|
||||
// This kart would not get any lap counting done in the first
|
||||
// lap! Therefor -1.5 is subtracted from the y position - which
|
||||
// is a somewhat arbitrary value.
|
||||
// lap! Therefore an offset is substracted from its Y location,
|
||||
// and this offset is calculated based on the drivelines
|
||||
float offset = 1.5f;
|
||||
if(m_left_driveline[0].getY() > 0 || m_right_driveline[0].getY() > 0)
|
||||
offset += std::max(m_left_driveline[0].getY(), m_left_driveline[0].getY());
|
||||
|
||||
orig.setX( pos<m_start_x.size() ? m_start_x[pos] : ((pos%2==0)?1.5f:-1.5f) );
|
||||
orig.setY( pos<m_start_y.size() ? m_start_y[pos] : -1.5f*pos-1.5f );
|
||||
orig.setY( pos<m_start_y.size() ? m_start_y[pos] : -1.5f*pos-offset );
|
||||
orig.setZ( pos<m_start_z.size() ? m_start_z[pos] : 1.0f );
|
||||
}
|
||||
btTransform start;
|
||||
|
||||
@@ -106,7 +106,7 @@ public:
|
||||
std::vector<Vec3> m_start_positions;
|
||||
|
||||
//Left and Right drivelines for overhead map rendering.
|
||||
//(Should probably be private as they are only use internally right now)
|
||||
//(Should probably be private as they are only used internally right now)
|
||||
std::vector<Vec3> m_left_driveline;
|
||||
std::vector<Vec3> m_right_driveline;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user