Clean skidmark earlier if there are many karts

This commit is contained in:
Benau 2016-12-23 10:08:12 +08:00
parent 969592e3fc
commit a339975df6
2 changed files with 8 additions and 3 deletions

View File

@ -72,8 +72,10 @@
delta-angle="0.5" />
<!-- Skidmark data: maximum number of skid marks, and
time for skidmarks to fade out. -->
<skid-marks max-number="100" fadeout-time="60"/>
time for skidmarks to fade out. Maximum number will over
current number of karts, so the more karts, the less
skidmark is on track. -->
<skid-marks max-number="500" fadeout-time="60"/>
<!-- Defines when the upright constraint should be active, it's
disabled when the kart is more than this value from the track. -->

View File

@ -25,6 +25,7 @@
#include "karts/controller/controller.hpp"
#include "karts/abstract_kart.hpp"
#include "karts/skidding.hpp"
#include "modes/world.hpp"
#include "physics/btKart.hpp"
#include <IMeshSceneNode.h>
@ -208,7 +209,9 @@ void SkidMarks::update(float dt, bool force_skid_marks,
// The scene node will keep the mesh alive.
new_mesh->drop();
m_current++;
if(m_current>=stk_config->m_max_skidmarks)
int cleaning_threshold =
core::clamp(int(World::getWorld()->getNumKarts()), 5, 15);
if(m_current>=int(stk_config->m_max_skidmarks/cleaning_threshold))
m_current = 0;
if(m_current>=(int)m_left.size())
{