Merge branch 'Fix3462'
This commit is contained in:
commit
457594379c
@ -69,9 +69,14 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
// has check defined.
|
||||
if(!lin_world)
|
||||
return false;
|
||||
|
||||
// the lapline is considered crossed if the kart is on the road (off-road is not accepted)
|
||||
// near the beginning of the track while the lapline is active (meaning the proper
|
||||
// checklines were activated). "Near the beginning of the track" is arbitrarily
|
||||
// defined to be the first 1/10th of the track.
|
||||
float current_distance = lin_world->getDistanceDownTrackForKart(kart_index, false);
|
||||
bool result = (m_previous_distance[kart_index]>0.95f*track_length &&
|
||||
current_distance<7.0f);
|
||||
float threshold = 0.1f * track_length;
|
||||
bool result = current_distance < threshold && lin_world->isOnRoad(kart_index);
|
||||
|
||||
if (UserConfigParams::m_check_debug && result)
|
||||
{
|
||||
@ -80,7 +85,9 @@ bool CheckLap::isTriggered(const Vec3 &old_pos, const Vec3 &new_pos,
|
||||
m_previous_distance[kart_index], current_distance);
|
||||
}
|
||||
|
||||
m_previous_distance[kart_index] = current_distance;
|
||||
// Cannot cross lap when off-road, since we are not sure where the kart is
|
||||
if (lin_world->isOnRoad(kart_index))
|
||||
m_previous_distance[kart_index] = current_distance;
|
||||
|
||||
if (result)
|
||||
lin_world->setLastTriggeredCheckline(kart_index, m_index);
|
||||
|
Loading…
Reference in New Issue
Block a user